Apache OpenOffice (AOO) Bugzilla – Issue 115467
Exception when using resultset.next() on second entry.
Last modified: 2013-01-29 22:01:37 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.
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.