Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / May 2006

Tip: Looking for answers? Try searching our database.

Update statements.

Thread view: 
morc - 25 May 2006 15:45 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
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.