c#修改access数据库,这条指令总是提示updata有错误,实在看不出了,请高手帮忙
if(comboBox1.Text!=""){stringmysql="updatejiaoshixinxisetidentity='"+comboBox1.Text.T...
if (comboBox1.Text != "")
{
string mysql = "update jiaoshixinxi set identity ='" + comboBox1.Text.Trim() + "'where teacherid = '" + textBox4.Text.Trim() + "'";
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = mysql;
cmd.Connection = jiaoshi.myConn1;
cmd.ExecuteNonQuery();
tag = 1;
} 展开
{
string mysql = "update jiaoshixinxi set identity ='" + comboBox1.Text.Trim() + "'where teacherid = '" + textBox4.Text.Trim() + "'";
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = mysql;
cmd.Connection = jiaoshi.myConn1;
cmd.ExecuteNonQuery();
tag = 1;
} 展开
展开全部
非字符串值是不用加单引号的,你看看你的数据库字段类型
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
where前加个空格试试?
string mysql = "update jiaoshixinxi set identity ='" + comboBox1.Text.Trim() + "' where teacherid = '" + textBox4.Text.Trim() + "'";
string mysql = "update jiaoshixinxi set identity ='" + comboBox1.Text.Trim() + "' where teacherid = '" + textBox4.Text.Trim() + "'";
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询