Click to See Complete Forum and Search --> : Determining empty recordset


cotec
08-08-2005, 07:59 AM
I'm performing a number of queries on a database, not all of which will actually return a recordset. How do I determine if there are any records in the recordset? I had tried using: "if rs.MoveFirst then", but I get an ASP error that says that "Either BOF or EOF is True, or the current record has been deleted."

Chris

buntine
08-08-2005, 08:02 AM
You do as the error implies. ;)

'| Check for empty RecordSet.
If rs.EOF And rs.BOF Then
Response.Write "Empty RecordSet Object!"
End If

The MoveFirst function will actually attempt to position the cursor at the first index. If it does not exist, an error is thrown.

Regards.