Issue 115467 - Exception when using resultset.next() on second entry.
Summary: Exception when using resultset.next() on second entry.
Status: UNCONFIRMED
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: OOo 3.3 RC3
Hardware: Mac Mac OS X 10
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-08 10:02 UTC by olaf_stetzer
Modified: 2013-01-29 22:01 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description olaf_stetzer 2010-11-08 10:02:12 UTC
In a basic macro I am reading data from a table using the recordset object.
This used to work before in a previous version, now, when the following loop
is executed for the second time I get an exception without any further
information about what is wrong. The exception is thrown at the While
Resultset.next() line:

...... some code defining statement and query.
ResultSet = Statement.executeQuery(sQuery)

If Not IsNull(ResultSet) Then
    While ResultSet.next()
    ..... some code reading data from resultset and using it
    Wend
End If  

Interestingly, the first entry can be read without a problem.
Comment 1 olaf_stetzer 2010-11-08 10:18:14 UTC
I just had an idea and tried something: The problem seems to be related to the
fact, that I used one statement multiple times. This used to work with older
versions of OOo base. Meaning:
I create a statement, the use it for one resultset, then for the next resultset
but then while I am still using the second resultset, pass the statement on to a
subroutine. This subroutine creates its own resultset from it and uses it. 
I am pretty sure that this used to work before, however, it may be that this is
not the intended way of using a statement. When I now modifiy my code to pass on
only the connection instead of a statement and create one statement for each
resultset I need (also in the subroutine) then everything seems to work.