请帮助,在update语句中获取语法错误。 当我尝试更新数据库中的值(msaccess)
时会发生这种情况try
{
DialogResult dr = MessageBox.Show("Are you sure you want to update?", "Details Updation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.No)
{
return;
}
else
{
OleDbConnection oleDbConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=users.mdb;Persist Security Info=False");
OleDbCommand update = new OleDbCommand("UPDATE users SET user = '"+textBox2.Text+"' where code = 1", oleDbConnection);
oleDbConnection.Open();
update.ExecuteNonQuery();
oleDbConnection.Close();
MessageBox.Show("User name updated successfully", "Update Username", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (SystemException se)
{
MessageBox.Show(se.Message);
}
finally
{
}