We Recommend

Java How to Program Java How to Program
Takes a new tools-based approach to Web application development that uses Netbeans 5.5 and Java Studio Creator 2 to create and consume Web Services. Features new AJAX-enabled, Web applications built with JavaServer Faces (JSF), Java Studio Creator 2 and the Java Blueprints AJAX Components. Includes new topics throughout, such as JDBC 4, SwingWorker for multithreaded GUIs, GroupLayout, Java Desktop Integration Components (JDIC), and much more.


Posted By

indianocean on 07/27/07


Tagged

sql


Versions (?)


Check if reultset is empty without side effect


Published in: Java 


URL: http://groups.google.de/group/comp.lang.java.databases/browse_thread/thread/c4964fde14ffc48b/77a690f6fe039800?lnk=st&q=java+resultset+empty&rnum=10&hl=en#77a690f6fe039800

  1. Results rs = stmt.executeQuery() // or whatever
  2. if( !rs.next() )
  3. {
  4. // no results returned
  5. }
  6.  
  7. else
  8. {
  9. do
  10. {
  11. // process next results row
  12. }
  13. while( rs.next() );
  14. }

Report this snippet 

You need to login to post a comment.