Firebird Recordsets FORWARD_ONLY

Hallo everybody,

after I have converted my database tables from HSQLDB to Firebird I found a strange behaviour with recordsets.

After executing a query I need the number of records in the recordset. As there was / is(?) no recordCount property I use the following code:

Function getRecordCount(objResult As Object) As Long
Dim intCount As Long

' initialize Count
intCount = 0
' iterate over resultset
While objResult.Next()
	' increment Count
	intCount = intCount + 1
' Reposition the cursor
' Return RecordCount
getRecordCount = intCount

End Function

When I reposition the cursor with objResult.First() an error occurs ‘first not supported in firebird’. If I comment out the while loop everything is executed without an error. That seems to mean that the resultset is FORWARD_ONLY - but it is in fact declared like this:

Function getResultSet(objDbCon As Object, strSql As String) As Object	
Dim objStatement As Object
Dim objResult As Object

' Statement erstellen
objStatement = objDbCon.createStatement()
objStatement.ResultSetConcurrency = _
objStatement.ResultSetType = _
' Abfrage ausfuehren
objResult = objStatement.executeQuery(strSql)
' ResultSet zurückgeben
getResultSet = objResult

End Function

In the HSQLDB-Verion everything works as it should - could it be reultsets are declared FORWARD_ONLY regardles what you state?


Please see my answer in this post → firebird equivalent for resultset.last.