tags:

views:

69

answers:

1

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();
  }
+1  A: 

Well a quick look says you have an extra comma

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

DJ