Coral_Lover
10-02-2002, 04: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.
|
||||
JSP ResultSetCoral_Lover 10-02-2002, 04: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. ritap 10-04-2002, 02: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; while(rs.next()) { cntr++; %> <tr> <td><%= rs.getString("name") %></td> <td><%= rs.getString("ssn") %></td> <td><%= rs.getDate("rcvd") %></td> </tr> <% } %> So when no rows are retrieved cntr = 0. I print the cntr out once all the rows are read. Hope this helps. Rita |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum