PDA

View Full Version : Where's the syntax error in this SQL statement?


mattdbrat
03-28-2009, 02:43 AM
public static void editItemType( String itemID, String desc, String catID, String retail, String wholesale, String unitname, String origID ) throws Exception
{

...

int newID = Integer.parseInt( itemID );
int oldID = Integer.parseInt( origID );

PreparedStatement ps = con.prepareStatement( "UPDATE itemtype SET itemID = ?, desc = ?, catID = ?, retail = ?, wholesale = ?, unitname = ? WHERE itemID = ?" );
ps.setInt( 1, newID );
ps.setString( 2, desc );
ps.setInt( 3, Integer.parseInt(catID) );
ps.setDouble( 4, Double.parseDouble(retail) );
ps.setDouble( 5, Double.parseDouble(wholesale) );
ps.setString( 6, unitname );
ps.setInt( 7, oldID );
ps.executeUpdate();

...

}



I have an MS Access database with a table named "itemtype" and here are the fields:

itemID...........Number
desc.............Text
catID............Number
retail.............Number
wholesale.......Number
unitname........Text
quantity.........Number

I really don't understand how the JSP I'm using says that there is a syntax error in my UPDATE statement. The line that says ps.executeUpdate() is pointed out in the stack trace.

Where's the error in my UPDATE statement?

shyam
03-29-2009, 11:09 AM
can you post the stacktrace and the exception that you are getting?