This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Servlets and the fly likes Please help....confused: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

Please help....confused:

Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Hi Friends,
Here is piece of my servlet from first query I got userID and now I don't know how can I pass "userID" to the second query?
Many thanks for your help,
PrepStmt =con.prepareStatement("select userID from user where name =" +name);
while ( {
C_BugList xobj=new C_BugList();

//Create a Statement Object
stmt = con.createStatement();
//Second query
PrepStmt =con.prepareStatement("update bug set values (?) where bugNumber="+bugNumber);

DC Dalton
Ranch Hand

Joined: May 28, 2001
Posts: 287
Instead of using this line:
why not do something like this:
String userID = rs.getInt("userID");
This way the userID variable is available to your second query.
Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Thank you
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I agree. Here's the link:
subject: Please help....confused:
It's not a secret anymore!