Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Im using the code below, to update a record in an MS Access database, to store some information related to a property grid, however, im receiving a syntax error when the query tries to execute, and i cannot figure out why. ConnCheck simply looks to see if the connection is open, and if not, it opens it.

Thanks in advance

  Main_Class.ConnCheck();
  OleDbCommand cmd = new OleDbCommand("UPDATE [CALCULATION_RUN_TBL] SET [CAP_INPUTS]=?, [RA_INPUTS]=?, WHERE [CALCULATION_RUN_ID]=?", Main_Class.con);
  try
  {
    cmd.Parameters.Add("@CAP_INPUTS", OleDbType.LongVarBinary).Value = SaveCAPSettings();
    cmd.Parameters.Add("@RA_INPUTS", OleDbType.LongVarBinary).Value = eig.SaveSettings();
    cmd.Parameters.Add("@CALCULATION_RUN_ID", OleDbType.Integer).Value = Main_Class.Calculation_Run_ID;
    //Main_Class.con.Open();
    cmd.ExecuteNonQuery();                            
    Main_Class.con.Close();
  }
  catch (OleDbException ex)
  {
    //get the error message if connection failed
    MessageBox.Show("Error in connection ..." + ex.Message);
    Main_Class.con.Close();
  }
share|improve this question

1 Answer

Well a quick look says you have an extra comma

This: [RA_INPUTS]=?, WHERE should be [RA_INPUTS]=? WHERE

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.