This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes value operations on database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "value operations on database" Watch "value operations on database" New topic
Author

value operations on database

egbai mmumene
Ranch Hand

Joined: Sep 18, 2012
Posts: 43
can't seem to get the right syntax for using the UPDATE and SET statement getting an error line at the "notxt" variable. i'm trying to minus a variable in the database by 1 every time an action is performed here is the code
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Egbai can you format your post to use code tags, can you look at other posts and see how much easier they are to read.

and can you provide us with the exact exception text please.

do you want to update every movie on the database, as without a where clause that is what will happen.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

and what type is stat i am presuming it is a Statement, but it may not be.
egbai mmumene
Ranch Hand

Joined: Sep 18, 2012
Posts: 43
Yes its stat is statement. There is no exception cause i've not run the code yet due to the error line appearing at the "notxt" variable. Want to know how to put the quotations or declare the variable if it is in the wrong way. Then please i dont know how to add the WHERE clause due to the earlier error. Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Can you tell us what this "error" is? For all we know it's a compiler error and nothing at all to do with the syntax of your SQL. So copy it from wherever you're seeing it, and post it in a reply here.
shiva pandey
Greenhorn

Joined: Jan 24, 2011
Posts: 10
You have declared your "notxt" varriable inside the while loop and using it outside the loop.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

egbai mmumene,
Your post was moved to a new topic.
i have split the last question out and moved it to the swing forum.
 
 
subject: value operations on database
 
Similar Threads
Data input from app to database
If/Else/Switch Statements
why not load class
How to retrieve multiple row data from oracle table and show it in jsp page
SQLException: No data found