sriky
November 2nd, 1999, 03:56 PM
How can I check if a recordset is empty or not. If not, I want to empty it before opening it.
Thanks
Thanks
|
Click to See Complete Forum and Search --> : recordset sriky November 2nd, 1999, 03:56 PM How can I check if a recordset is empty or not. If not, I want to empty it before opening it. Thanks Andrew November 2nd, 1999, 04:34 PM 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. czimmerman November 2nd, 1999, 05:41 PM 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, 11:37 AM 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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |