Forums Register Login

Update Using a preparedstatement

+Pie Number of slices to send: Send
hello,
i have this question. i want to update a data base record. so i am using this coding.
PreparedStatement st_stockaddps=st_stockaddcon.prepareStatement("INSERT INTO inventory VALUES("+st_descriptionst+","+st_ppust+","+st_qtyst+","+st_reorderlevelst+","+st_suppliercodest+","+st_totalcostst+","+st_totalcostst+")WHERE I_Code=?");
st_stockaddps.setString(1,st_itemcodest);
st_stockaddps.executeUpdate();
but the problem is when i execute this statement it gives a sql exception saying "Missing semicolon( at the end of sql statement..
please send a quick reply. thank you.
+Pie Number of slices to send: Send
hi,
you certainly will have more success by posting this at the jdbc forum.
normally the jdbc driver cares for semicolons at the end. so at a first glance, this seems to be a driver problem?
cheers,
chantal
+Pie Number of slices to send: Send
Yep... moving this to the JDBC forum...
+Pie Number of slices to send: Send
Your problem stems from the fact that you are performing an INSERT with a WHERE clause. You can not have a WHERE clause on an insert.
Jamie
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1116 times.
Similar Threads
Why Batch Update Support Only One Single PreparedStatement
Prepared statement
Prepared Statement
update through prepared statement
Welcome Lynn Beighley
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:00:29.