This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes How to display all the results of a Table? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How to display all the results of a Table?" Watch "How to display all the results of a Table?" New topic

How to display all the results of a Table?

Jan Michael Soan
Ranch Hand

Joined: Feb 08, 2003
Posts: 36
I have a problem displaying all the results of a Table from my database. My purpose is to display all the results of the table to My given JTextFields.
for example :
Statement statement1 = connect.createStatement();
String query1 = "SELECT FROM Lastname";

ResultSet rs1 = statement1.executeQuery(query1);;
// here's the problem. I don't know how to get all the results
// what I know is to display only the 1st string.
// is there any method to display all the results of a table.
// instead of displaying only the 1st String?
String pass1 = "" + rs1.getString(1);
x's: Pls. help its an emergency !.
Thanks . . .
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
(I'm perhaps not completely understanding your question.)
If I've a table called student that has fields fName and lName, and I want to display the name of everybody in the table, then I might use code similar to the following.Getting any ideas?
[ March 16, 2003: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: How to display all the results of a Table?
It's not a secret anymore!