Two Laptop Bag
The moose likes JDBC and Relational Databases and the fly likes sqlException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "sqlException" Watch "sqlException" New topic


kelly devon
Ranch Hand

Joined: Apr 15, 2004
Posts: 77

someone help me out here i am trying to update using my gui
an access database and i keep getting an SQLException which
says "SQLException too few parameters expected1"
and this is the line of code doing this
correction are welcomed thanks

Rajendar Goud
Ranch Hand

Joined: Mar 06, 2002
Posts: 220
With the exception it looks like the parameters you r passing are less as compared to what the query expects.

In the query
stat.executeupdate("UPDATE Stock"+"SET Qty(dbfieldname)="+ quantity(variable)+" "+WHERE Itemsno(dbfieldname)='"item+"'");

quantity(variable) is a field i guess which u r picking from GUI.
so it too must be in single quotes .

stat.executeupdate("UPDATE Stock"+"SET Qty(dbfieldname)='"+ quantity(variable)+"'"+WHERE Itemsno(dbfieldname)='"item+"'");

try this out

kelly devon
Ranch Hand

Joined: Apr 15, 2004
Posts: 77
I agree. Here's the link:
subject: sqlException
It's not a secret anymore!