PRB: ADO: Recordcount May Return -1 (194973)
The information in this article applies to:
- ActiveX Data Objects (ADO) 1.5
- ActiveX Data Objects (ADO) 2.0
- ActiveX Data Objects (ADO) 2.1 SP2
- ActiveX Data Objects (ADO) 2.5
- ActiveX Data Objects (ADO) 2.6
- ActiveX Data Objects (ADO) 2.7
This article was previously published under Q194973 SYMPTOMS
When you request the RecordCount for a serverside recordset, a -1 may
return. This occurs with ActiveX Data Objects (ADO) version 2.0 or later when the CursorType is adOpenForwardonly or adOpenDynamic. This occurs with ADO 1.5
only when the cursortype is adOpenForwardonly. Testing with the OLEDB
provider for JET and SQL Server produces varying results, depending on the
provider.
Providers may not support some CursorTypes. When you select a CursorType
that is not supported, the provider should select the CursorType closest to
what you request. Please refer to the documentation that comes with your
provider. Also, please note that not all combinations of LockType and
CursorType work together. Changing a LockType may force a change in the
CursorType. Be sure to use debug to check the value of CursorType when
conducting tests with your OLEDB provider.
CAUSE
The number of records in a dynamic cursor may change. Forward only cursors
do not return a RecordCount.
RESOLUTION
Use either adOpenKeyset or adOpenStatic as the CursorType for server side
cursors or use a client side cursor. Client side cursors use only
adOpenStatic for CursorTypes regardless of which CursorType you select.
STATUS
This behavior is by design.
REFERENCES
ActiveX Data Objects (ADO) Help; search on: "CursorType Property."
Modification Type: | Minor | Last Reviewed: | 3/2/2005 |
---|
Keywords: | kbDatabase kbDSupport kbprb KB194973 |
---|
|