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

Reply via email to