View Full Version : JSP ResultSet
10-02-2002, 05:57 AM
Hi, how do i check that a resultset is empty, or a resultset is not found?? If it is not empty, it will retrieve all the records and display it.
10-04-2002, 03:04 PM
rs.next will return a false if you have no more rows to retrieve. If no rows are received then it will return false the first time you call it. If there is a row to get, it retrieves it.
Here is a sample of code that I use
ResultSet rs = stmt.executeQuery(strQry);
int cntr = 0;
<td><%= rs.getString("name") %></td>
<td><%= rs.getString("ssn") %></td>
<td><%= rs.getDate("rcvd") %></td>
<% } %>
So when no rows are retrieved cntr = 0. I print the cntr out once all the rows are read.
Hope this helps.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.