*
The moose likes Servlets and the fly likes how to display more than one result from the db.. 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 » Java » Servlets
Bookmark "how to display more than one result from the db.." Watch "how to display more than one result from the db.." New topic
Author

how to display more than one result from the db..

City Guy
Greenhorn

Joined: Oct 15, 2001
Posts: 2
if (rs != null) {
if (rs.next()) {
xxx = rs.getString("");
xxx = rs.getString("");
xxx = rs.getString("");
xxx = rs.getString("");
xxx = rs.getString("");
this will only disply one record ...
Mahesh Rana
Ranch Hand

Joined: Sep 05, 2001
Posts: 139
<code>
if(rs != null)
{
while(rs.next())
{
x = rs.getString("X");
}
}
</code>


SCJP2
namita pa
Ranch Hand

Joined: Sep 06, 2001
Posts: 56
ya its better to do it in the while loop as it checks all the records in the resultset
------------------
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to display more than one result from the db..
 
Similar Threads
describing the table!!!...
WA #1.....word association
gettting value by column name vs index
Regex | Parse | Split?
Error in downloading ZipoutputStream