Anjan Kumar

Anjan Kumar

  • NA
  • 6
  • 2.3k

Unable to Update in C# Access 2003

May 4 2014 6:05 AM

  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)