I think there is a difference between resultset being empty & resultset being null.
If the resultset is empty it means that no rows were returned for the query & thats the reason the following line is executed.
out.println("result set has got something");
But I am sure "while (rs.next())" statement will print ("result set is empty");
Originally posted by Bhasker Reddy:
if (rs != null)
{
out.println("result set has got something");
while (rs.next())
{ //I am processing result set now
}
}
else
{
out.println("result set is empty");
}
IS THIS CORRECT WAY TO CHECK IF RESULT SET IS EMPTY,
FOR ME EVEN THOUGH RESULT SET IS EMPTY IT IS GOING
INTO FIRST BLOCK AND PRINTING
RESULT SET HAS GOT SOMETHING.
CAN SOMEONE ADVISE ME ON THIS