Issue 115467

Summary: Exception when using on second entry.
Product: Base Reporter: olaf_stetzer <olaf.stetzer>
Component: codeAssignee: AOO issues mailing list <issues>
Status: UNCONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues
Version: OOo 3.3 RC3   
Target Milestone: ---   
Hardware: Mac   
OS: Mac OS X 10   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

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 line:

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

If Not IsNull(ResultSet) Then
    ..... some code reading data from resultset and using it
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.