my dog learned polymorphism*
The moose likes JDBC and the fly likes ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ResultSet" Watch "ResultSet" New topic
Author

ResultSet

Ekrem Altintas
Greenhorn

Joined: Dec 20, 2005
Posts: 14
I created a resultset object.I want to know if record(s) exist or not.Do you know a method for it?
Michael Duffy
Ranch Hand

Joined: Oct 15, 2005
Posts: 163
Originally posted by Ekrem Altintas:
I created a resultset object.I want to know if record(s) exist or not.Do you know a method for it?


yes, java.sql.ResultSet.next() method returns true if there's another record available, false if not.


%
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Its better to check the API Docs prior to post this kind of questions.
Adam Richards
Ranch Hand

Joined: Nov 03, 2005
Posts: 135
Here's another possible (and reusable) approach. Call the getRowCount() function below & see if the return value is greater than zero.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResultSet
 
Similar Threads
result set in session
How to sort a ResultSet
How resultset is returned by stored procedure?
Serializing ResultSet
How do you know number of rows fetched by ResultSet?.