sSQL = "some sql query"
Dim SenderFilter As Object = pConn.ExecQueryAsync("SQL", sSQL, Null)
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs As ResultSet)
if Not(rs.NextRow) Then
' do something else
else
' do this code
end if
rs.close
I have found the if no rows are returned from the query the resultset appears to be closed on return, so the 'if Not(rs.NextRow) Then' failes with an error, com.microsoft.sqlserver.jdbc.SQLServerException: The result set is closed.
If there are no results the Resultset is not Initialized.
B4X:
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs As ResultSet)
if rs.isInitialized then
if Not(rs.NextRow) Then
' do something else
else
' do this code
end if
rs.close
else
' Do something else as the query returns 0 Results.
end if
That sounds strange, assuming you are using the same code as DonManfred. Isinitialised is a B4J function that merely checks whether the wrapped ResultSet object is null or not. I wouldn't expect it to be capable of returning a SQLServerException as it doesn't touch the object itself.
Java:
public boolean IsInitialized() {
return (this.object != null);
}
That sounds strange, assuming you are using the same code as DonManfred. Isinitialised is a B4J function that merely checks whether the wrapped ResultSet object is null or not. I wouldn't expect it to be capable of returning a SQLServerException as it doesn't touch the object itself.
Java:
public boolean IsInitialized() {
return (this.object != null);
}
Yep, strange indeed. I dont know why the rs is return as closed. It is initialised, as I have checked that. It is the rs.nextrow that cause's the exception.