File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Why this goes into do...while with null result set? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Why this goes into do...while with null result set?" Watch "Why this goes into do...while with null result set?" New topic
Author

Why this goes into do...while with null result set?

Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
I have a do...while that's giving me a weird problem. I have multiple resultsets returned to a statement, and so I get the first one in the "do" by calling getResultSet(), then I do what I need with it and then have a while statement that checks "getMoreResults() and "getUpdateCount()". However, I always have the last time through where it gets everything from the last resultset, then does the "while" check and continues back to the "do" again, but this time the resultset is NULL!! Why doesn't the while statement keep it from doing that?
do
{
..something..
} while ( !statement.getMoreResults() && ( statement.getUpdateCount() == - 1 ) );
This always goes one resultset too far, giving me a null one inside the "do"!
Anyone know what's wrong?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why this goes into do...while with null result set?