Article ID: 308352 - View products that this article applies to.
This article was previously published under Q308352
For a Microsoft Visual Basic .NET version of this article, see 308050
This article refers to the following Microsoft .NET Framework Class Library namespaces:
When you use the OleDbDataReader or SqlDataReader class, no RecordCount property exists to indicate how many records are being fetched.
The DataReader object or the back-end data source does not typically know how many records are being fetched until the last record is sent to the client.
Even an ActiveX Data Objects (ADO) Recordset returns -1 for the RecordCount property when it uses a forward-only cursor to retrieve data. DataReader exhibits similar behavior because it uses a forward-only cursor to retrieve rows and columns.
To work around this problem, use one of the following methods:
Steps to reproduce the behavior
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/194973/ )ADO: Recordcount may return -1
Article ID: 308352 - Last Review: December 11, 2006 - Revision: 3.7
Contact us for more help