NoCoolHandle,
"Yes you can!!!
-1 = true
i.e. We have a record!
This will always show with Firehose and dynamic cursors because they dont care were they are, just that there is a record@!"
- on my setup it gives -1 regardless of whether .bof/.eof is true or false - so I don't know whether or not I have a record.
Besides, the documentation states that dynamic cursor will return -1 or the actual count depending on data source.
"What do you get for a recordcount when you get rid of the last parameter?
adCmdText
i.e. rs2.Open "select * FROM Feb910", g_AdoDBCn, adOpenKeyset, adLockOptimistic
My guess is a good (non -1) recordcount."
On my setup, the OP's initial code, gives a correct count regardless of cursor location and regardless of whether or not the CommandTypeEnum is specified.
I've never relied on the .RecordCount property of ADO recordsets (I don't think I used it much with DAO either, though it's more reliable there), but did some small, not very academic testing some years ago. Like in this thread, it showed different behaviour under different conditions and on different computers, some also with the same MDAC.
The decision of whether or not to trust the .RecordCount property of ADO recordsets, is entirely up to the reader, I don't, and my advise, is the same as what I stated in the first reply:
"Bottom line, if you really, really need a recordcount - use a select count(*) from the table with same where condition (my opinion). To just test if the recordset contains records, test for .bof/.eof."
Roy-Vidar