|
-
November 2nd, 1999, 04:56 PM
#1
recordset
How can I check if a recordset is empty or not. If not, I want to empty it before opening it.
Thanks
-
November 2nd, 1999, 05:34 PM
#2
Re: recordset
Are you using the ADODC recordset? If so then you could use the .RecordCount property to return the number of records. Then again, when an ADODC recordset is closed, it is empty anyway.
-
November 2nd, 1999, 06:41 PM
#3
Re: recordset
If you want to check before it's open, you can run a query to check the count (e.g., "SELECT COUNT(*) AS MYCOUNT FROM MYTABLE"). If rs("MYCOUNT") = 0, there are no records.
If you can open it first, you can either check the recordcount property, or if recordcount is not supported (e.g., on firehose cursors), you can use the following
if rs.bof and rs.eof then
'recordset has no reocords
end if
Charlie Zimmerman
http://www.freevbcode.com
-
November 30th, 1999, 12:37 PM
#4
Re: recordset
It depends upon how your Recordset was created. If you specify a static
cursor on the Recordset.Open method then you will be able to use the
RecordSet.RecordCount property. If you use any other cursor, RecordCount
will always return -1.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|