resultSet class does have a method to check if it's empty or not.
-----Original Message-----
From: Matthias Brantner [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 31, 2000 7:12 AM
To: [EMAIL PROTECTED]
Subject: Re: Check the JDBC result value
HI
> u could also have a counter for numbers initialize it to zero before the
loop
> and if it's still zero after the loop, the u know ur query returned null.
the
> disadvatange of using
> the following(with due apologies to Matthias):
> ResultSet rs = executeQuery(Select);
> boolean hasResults = rs.next();
> if (!hasResults) {
> ...
> }
> else {
> while (hasResults) {
> ...
> hasResults = rs.next();
> }
> }
> is that u will have skipped one item in the query due to ur having asked
it to
> go to the next item(rs.next()) during ur check. The only way around this
is
> creating another resultset, which, needless to say is a waste of time
given
> that there r easier solutions.
you don't have to apologize, because you won't skip one item. The cursor
in the ResultSet is before the First Element at the beginning. So, you
move to the first, then you get the first result, you move to the
next...
See you
Matthias
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html