oledbcommand executenonquery access update error
本文关键字:error update access executenonquery oledbcommand | 更新日期: 2023-09-27 18:30:22
当我运行此代码时,它显示错误,请帮助我!
`int code = int.Parse(tbxcode.Text);
string name = tbxname.Text;
string description = tbxdescription.Text;
bool active = true;
int idcompany = cbxcompany.SelectedIndex;
string kala = cbxkala.SelectedValue.ToString();
int id = int.Parse(kala);
oleDbCommand1.Parameters.Clear();
oleDbCommand1.CommandText = "update kala set code=" + code + ", name=" + name + ", description=" + description + ", active=" + active + ", idcompany=" + idcompany + " where id=" + id;
oleDbConnection1.Open();
oleDbCommand1.ExecuteNonQuery();
oleDbConnection1.Close();
oleDbCommand1.Parameters.Clear();`
也许你应该为文本列添加"'"
oleDbCommand1.CommandText = "update kala set code=" + code + ", name='" + name + "', description='" + description + "', active=" + active + ", idcompany=" + idcompany + " where id=" + id;
如果不是这样,消息错误是什么