hey im having a little bit of trouble excecuting my update statsments.
I chekd in access directly and am sure that there is no errors in my
SQL.
this is the code i used. The connection is fine its been tested before.
String remove = "UPDATE items SET qty = qty - 1 WHERE store =
'"+from+"' and barcode ='"+barcode+"'";
Statement stmt = null;
try {
stmt = conn01.createStatement();
stmt.executeUpdate(remove);
} catch (SQLException e) {
e.printStackTrace();
}
If anyone knows what the error is it would be greatly appreciated.
thanks
-morc
ChrisH - 25 May 2006 16:20 GMT
You didn't give the error, but I'll put on my psychic hat and suggest
you need to terminate the SQL statement with a ';'
Cheers
David Harper - 25 May 2006 19:38 GMT
> hey im having a little bit of trouble excecuting my update statsments.
> I chekd in access directly and am sure that there is no errors in my
[quoted text clipped - 13 lines]
> e.printStackTrace();
> }
It would be helpful if you could tell us
(a) what type of database server your program is talking to? Is it
Oracle? Is it MySQL? Or is it something else? What?
(b) what the stack trace looks like.
You might also want to consider using a prepared statement, in order to
avoid putting quotes directly into the query string.
David Harper
Cambridge, England