')' 附近有语法错误?~
string P_Str_ConnectionStr = @"server=LIUSHIQI\YUYU;user id=sa;pwd=1;database=bbsDB";
SqlConnection con = new SqlConnection(P_Str_ConnectionStr);
con.Open();
using (SqlCommand command = new SqlCommand("INSERT INTO USER_INFO" + "valuse (@userid)" ,con ))
{
command.Parameters.Add("@userid", SqlDbType.NVarChar , 20, "userid").Value = this.textBoxX1.Text;
command.ExecuteNonQuery();
}
con.Close();
------解决方案--------------------valuse
=》
values
------解决方案--------------------
"INSERT INTO USER_INFO" + "valuse (@userid)"
为什么用+号呢
直接INSERT INTO USER_INFO values (@userid)不行么
------解决方案--------------------@userid这是个变量么,应该把他跟加好引起来吧
"INSERT INTO USER_INFO values ("+@userid+")"
------解决方案--------------------"INSERT INTO USER_INFO" + "valuse (@userid)" 而且你这个插入语句也有错误啊!
没有提供表的插入列名,values写错,values 与 表名没有空格
"INSERT INTO USER_INFO (TableField) valuse (@userid)"