Article ID: 308050 - Last Review: March 9, 2006 - Revision: 1.3 There is no RecordCount property when yo use the OleDbDataReader class or the SqlDataReader class in Visual Basic .NETThis article was previously published under Q308050
For a Microsoft Visual C# .NET version of this article, see 308352
(http://support.microsoft.com/kb/308352/
)
.
This article refers to the following Microsoft .NET Framework Class Library namespace:
On This PageSYMPTOMS
When using the OleDbDataReader or SqlDataReader class, there is no RecordCount property to tell how many records are being fetched.
CAUSE
The DataReader object (or even the back-end data source) doesn't typically know how many records are being fetched until the last one is sent to the client. Even an ActiveX Data Objects (ADO) Recordset returns -1 for RecordCount when retrieving data using a forward-only cursor. DataReader exhibits similar behavior because it uses a forward-only cursor for retrieving rows and columns.
RESOLUTION
You can work around this problem in the following ways:
STATUSThis behavior is by design. MORE INFORMATIONSteps to Reproduce the Behavior
REFERENCESFor additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
194973
(http://support.microsoft.com/kb/194973/EN-US/
)
PRB: ADO: Recordcount May Return -1
| Article Translations
|
Back to the top
