Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-28-2009, 02:43 AM   PM User | #1
mattdbrat
New to the CF scene

 
Join Date: Mar 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
mattdbrat is an unknown quantity at this point
Where's the syntax error in this SQL statement?

Code:
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?
mattdbrat is offline   Reply With Quote
Old 03-29-2009, 11:09 AM   PM User | #2
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
can you post the stacktrace and the exception that you are getting?
__________________
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
shyam is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:48 PM.


Advertisement
Log in to turn off these ads.