• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
} 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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!