This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes sql problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "sql problem" Watch "sql problem" New topic
Author

sql problem

k mull
Greenhorn

Joined: Dec 15, 2004
Posts: 5


above is the code i'm using to select items from two tables

in the line item table there are 3 fiels - ORDER_NUMBER,PART_NUMBER + QTY!
for every order number there is a part number and quantity so i want to print out all the items associated with a certain order number
eg.
ORDER NUMBER 43567 has:
PART NUMBER QB-101, QTY 4
PART NUMBER QB-102, QTY 1

but when i want to print out these two part numbers it only prints out the first one. I've tried different things but i cant get more than one item to be printed out..Can anyone help?
Thomas Manthey
Greenhorn

Joined: Dec 16, 2004
Posts: 12
I think here is your answer:

http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html

when you open your recordset r for the inner loop, you loose your recordset rs in the outer loop. The solution is having a second statement-object.

Always remember: The API is your very best friend !


inside every large program there is a small program struggling to get out...
Thomas Manthey
Greenhorn

Joined: Dec 16, 2004
Posts: 12
Should be Resultset instead of Recordset, since this is clearly not MS-territory...
[ December 16, 2004: Message edited by: Thomas Manthey ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sql problem
 
Similar Threads
Problem displaying report using JSP
How to Export web page(jsp page) to excel using jsp or servlets
small question for a e-store problem
JSP returning old data, database was changed correctly!
Problem in updating the fields to database