Article ID: 308352 - Last Review: December 11, 2006 - Revision: 3.7 No RecordCount property exists to indicate how many records are being fetched when you use the OleDbDataReader or SqlDataReader class in Visual C#This article was previously published under Q308352
For a Microsoft Visual Basic .NET version of this article, see 308050
(http://support.microsoft.com/kb/308050/
)
.
This article refers to the following Microsoft .NET Framework Class Library namespaces:
On This PageSYMPTOMS
When you use the OleDbDataReader or SqlDataReader class, no RecordCount property exists to indicate how many records are being fetched.
CAUSE
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. RESOLUTION
To work around this problem, use one of the following methods:
STATUSThis behavior is by design. MORE INFORMATIONSteps to reproduce the behavior
REFERENCES
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
194973
(http://support.microsoft.com/kb/194973/
)
ADO: Recordcount may return -1
| Article Translations
|
Back to the top
