You need some comma's, a few less SET's and an equal instead of a + sign, like this:
    (*Chris*)
 
   Statement stmt = conn.createStatement();

   String updateString =("UPDATE StockTable "
        + "SET Description = Description, "
        + "Price = Price, "
        + "InStock = InStock "
        + "WHERE ID = ID");
 
   stmt.executeUpdate(updateString);
   conn.commit();
   stmt.close();
----- Original Message -----
Sent: Friday, November 05, 1999 9:25 PM
Subject: UPDATE

Hi all,
           I am having a bit of a problem with an UPDATE statement to an MS Access database. All of my other statements work well, such as DELETE, SELECT, etc. Could someone have a look at my code below, and show me where I have made a mistake? As it stands, I get a syntax error with the UPDATE statement. I am sure it is something simple, so any pointers will be appreciated.  I have included an example below:
 
 
   Statement stmt = conn.createStatement();

   String updateString =("UPDATE StockTable "
        + "SET Description = Description "
        + "SET Price = Price "
        + "SET InStock = InStock "
        + "WHERE ID + ID");
 
   stmt.executeUpdate(updateString);
   conn.commit();
   stmt.close();
  • UPDATE Ross Maguire
    • Chris Pratt

Reply via email to