how do i get the total number of rows in a recordset.
when i use the RecordCount, gives me -1
like:
vCount = rstMaster.RecordCount
returns -1 WHY ?????
ferror
ferror
ADO.NET will return -1 if it cannot determine the number of records or if the provider or cursor does not support RecordCount property.
Thread moved to the appropriate forum
Need 2 be back @ MS - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator
ahmedilyas
Hi,
I'm guessing you're using plain ADO (e.g. with VB6), not ADO.NET (as in .NET framework)?
If it is ADO, you're probably using server-side cursor. Use client cursor instead or loop through whole recordset (or .MoveLast) to get the count.
Andrej
Andrej Tozon
To be able to get an actual record count in ADO recordset, you need to open it on client side. In this case provider will return actual count. Otherwise provider is not able to determine it and will return -1.
This topic is not related to ADO.NET and will be locked and deleted later on