File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes using enhanced for insted of while - for reading resulset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "using enhanced for insted of while - for reading resulset" Watch "using enhanced for insted of while - for reading resulset" New topic
Author

using enhanced for insted of while - for reading resulset

Rohit Mehta
Ranch Hand

Joined: Mar 11, 2005
Posts: 79

hi
how can i read resultset using enhanced for loop - instead of while (rs.next)
thanks

rohit


- Rohit
Balagopal Kannampallil
Ranch Hand

Joined: Oct 18, 2004
Posts: 136

You cannot use ResultSet as such in an enhanced for-loop as it expects an Iterable object or an array. This link will help you understand the enhanced for-loop better.


SCJP 5.0 and now fighting with ExtJS
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: using enhanced for insted of while - for reading resulset