Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

I want to check if my ResultSet has records in it or it is empty?  RSS feed

 
Constantinos Grevenitis
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought that wasNull() was the one a I was wrong. Is there any method that checks that or do I have to do it "manually"?
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Constantinos,
You can try rs.next() which return a boolean value indecating that whether ResultSet has any record or not.

To explain more, When you execute a query and it return a resultset, resultset pointer is before first row, when you call resultSet.next() it trys to move to first rows and if the row is not present it will return false.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!