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 Checking the results of a ResultSet 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 "Checking the results of a ResultSet" Watch "Checking the results of a ResultSet" New topic
Author

Checking the results of a ResultSet

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
I am making a connection to a remote data table. 9 times out of ten I expect to return more than one record. To get my result I use the while(rs.next()) function. But how do I check to see if there are no records returned. In situations where only one record is expected I use if(rs.next()) which works great. How do I handle the empty while condition?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checking the results of a ResultSet
 
Similar Threads
Checking if ResultSet is empty
ResultSet and count urgent please help
Check the result set
unexpected output
Please Help me Ranchers