c# com.ExecuteNonQuery()出现语法错误
“/wz”应用程序中的服务器错误。这是打开网页时的状况,本人萌新不怕详细-------------------------------------------------...
“/wz”应用程序中的服务器错误。这是打开网页时的状况,本人萌新不怕详细--------------------------------------------------------------------------------Line 1: Incorrect syntax near 'information'. 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near 'information'.源错误: 行 117:行 118: SqlCommand com = new SqlCommand("insert into account information([UserName],[UserPwd],[RelName],[Tel])values('1','2','3','4')", conn);行 119: com.ExecuteNonQuery();行 120: conn.Close();行 121:
内个代码图太小了,我直接复制上来吧
SqlConnection conn = new SqlConnection();
string connectionString = "server=.;database=Userinfo;uid=zh; pwd=123456";
conn.ConnectionString = connectionString;
conn.Open();
SqlCommand com = new SqlCommand("insert into account information([UserName],[UserPwd],[RelName],[Tel])values('1','2','3','4')", conn);
com.ExecuteNonQuery();
conn.Close(); 展开
内个代码图太小了,我直接复制上来吧
SqlConnection conn = new SqlConnection();
string connectionString = "server=.;database=Userinfo;uid=zh; pwd=123456";
conn.ConnectionString = connectionString;
conn.Open();
SqlCommand com = new SqlCommand("insert into account information([UserName],[UserPwd],[RelName],[Tel])values('1','2','3','4')", conn);
com.ExecuteNonQuery();
conn.Close(); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询