I can’t figure out why this simple update command won’t work:
private void button1_Click(object sender, EventArgs e)
{
SqlCeCommand cmd = new SqlCeCommand("UPDATE tbl_Settings set password = '1234')", conn);
try
{
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
Error message:
There was an error parsing the query. [ Token line number = 1,Token line offset = 42,Token in error = ) ]
.
My select and insert commands works flawlessly:
SqlCeCommand cmd = new SqlCeCommand("SELECT password FROM tbl_Settings", conn);
string password = cmd.ExecuteScalar().ToString();
You have put some wrong closing brace in your query, remove that first.
Write your query like below