1
Answer

Unable to Update in C# Access 2003

Anjan Kumar

Anjan Kumar

10y
686
1

  int id = int.Parse(comboBox1.SelectedItem.ToString());
  cm = new OleDbCommand();
  cm.CommandText = "update tab1 set id=@id,name=@name,number=@number";
  cm.Connection = cn;
  cm.Parameters.AddWithValue("@id", id);
  cm.Parameters.AddWithValue("@name", textBox1.Text.Trim());
  cm.Parameters.AddWithValue("@number", textBox2.Text.Trim());
  cm.ExecuteNonQuery();

Is there anything wrong in this code,
it gives Syntax Error of UPDATE statement

Answers (1)