update语句语法错误,请大家帮忙解决。在线等.

来源:百度知道 编辑:UC知道 时间:2024/06/02 04:56:31
string strSQL = "UPDATE Goods SET";
strSQL += "编号=‘" + "this.textBox1.Text";
strSQL += "',名称='" + "this.textBox2.Text";
strSQL += "',单位='" + "this.textBox3.Text";
strSQL += "',单价='" + "this.textBox4.Text";
strSQL += "',产地='" + "this.textBox5.Text";
strSQL += "',类别='" + "this.textBox6.Text";
strSQL += "',供货总量='" + "this.textBox7.Text";
this.oleDbCommand1 .CommandText = strSQL;
this.oleDbCommand1.Connection = this.oleDbConnection1;
//打开数据库
this.oleDbConnection1 .Open();
//执行修改语句
this.oleDbCommand1 .ExecuteNonQuery();

strSQL += "',供货总量='" + "this.textBox7.Text"; 你数据表中的供货总量应该是数字型的吧,而这里是文本型的了,同样单价是否也有这个问题

strSQL += "编号=‘" + "this.textBox1.Text";

你这儿有一个这么大的全角下单引号...你没看见啊??改成半角下的单引:

strSQL += "编号='" + "this.textBox1.Text";