我的ConnectionString如下:
add name="TicketingSystemEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.20.103;initial catalog=TicketingSystem;persist security info=True;user id=sa;password=password;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"
我正在使用此代码:
public void CreateUser(String FirstName, String LastName, String Email, String Password, String MobileNumber, String DOB)
{
string cs = System.Configuration.ConfigurationManager.ConnectionStrings["TicketingSystemEntities"].ConnectionString;
SqlConnection con = new SqlConnection(cs);
string query1 = "insert into TEndUsers (FirstName,LastName,Email,MobileNbr,DateOfBirth,PasswordTED) values ("
+ FirstName + "," + LastName + "," + Email + "," + MobileNumber + "," + DOB + Password + ")";
SqlCommand cmd = new SqlCommand(query1, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
它给了我一个argumentException:不支持关键字:'metadata'。
你能帮忙吗?