• Post Reply Bookmark Topic Watch Topic
  • New Topic

using enhanced for insted of while - for reading resulset

 
Rohit Mehta
Ranch Hand
Posts: 79
Chrome Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
how can i read resultset using enhanced for loop - instead of while (rs.next)
thanks

rohit
 
Balagopal Kannampallil
Ranch Hand
Posts: 136
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!