A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
ResultSet return value for an empty query
Joined: Sep 27, 2002
Feb 20, 2003 05:17:00
When a query is executed and no resutls are found what value is returned to the ResultSet. In other words I need to determine if the ResultSet is empty.
What method do I use
Joined: Oct 11, 2000
Feb 20, 2003 05:30:00
After you have obtained a "ResultSet", for example:
Connection dbConn = ... String qry = "SELECT ..." Statement stmt = dbConn.createStatement(); ResultSet rs = stmt.executeQuery(qry);
then if that "ResultSet" is 'empty', the first invocation of the "ResultSet" methos "next()" will return 'false', as in:
rs.next(); // returns 'false' if no "next" row.
Hope this answers your question.
I agree. Here's the link:
subject: ResultSet return value for an empty query
JSP what's wrong with following code?
my query is successfully running in database but it is returning empty resultset in my java program
Not getting resultSet from Prepared statement
How to handl Null Values from Database
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015