现在的位置: 首页 > 综合 > 正文

关键字 ‘USER’ 附近有语法错误

2014年01月07日 ⁄ 综合 ⁄ 共 644字 ⁄ 字号 评论关闭
下面的代码:

“cmd.ExecuteNonQuery();”→“在关键字 'USER' 附近有语法错误。”还请各位再次伸出您们慷慨的手帮帮我~!

万分感谢~!

C# code
private void button1_Click(object sender, EventArgs e) { string qid = tb_id.Text; string qName = tb_Name.Text; string qAge = tb_Age.Text; string qemail = tb_email.Text; string qAddress = tb_Address.Text; SqlConnection con = new SqlConnection("server=(local);uid=sa;pwd=123;Integrated Security=True"); SqlCommand cmd = new SqlCommand("Insert Into USER( ID,Name,Age,email,Address)values('" + qid + "','" + qName + "','" + qAge + "','" + qemail + "','" + qAddress + "')",con); ///cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); ---------→“在关键字 'USER' 附近有语法错误。” con.Close(); }
 
 

 

 

 

 

user在SQL Server中是系统保留字
将user修改为[user]就可以了。
 

 

 

 

 

抱歉!评论已关闭.