Saturday, December 25, 2010

Size of the ResultSet ??

Do you know that there is no method defined to know the size of the ResultSet,
but there are other ways to achieve this.

the way is.....

  • Make your ResultSet Scrollable ( purely optional step you can use ResultSet also)
  • call rs.last()
  • call the getRow()  which will give you the current row number, ultimately it will give you the number of rows because we called the last method on ScrollableResultSet.
  • and finally call rs.beforeFirst() method to re point the pointer to the original position. 
Thanks
Yuvaraj Rajesh Kumar

No comments:

Post a Comment