When using MS-ADO to connect to ASE using ASE OLEDB/ODBC driver the record count is -1

Hi

VB 6 application connecting to ASE 12.5 (NT) using OLEDB/ODBC drivers. Gets
a problem.
He retrieve rows from the database - WORKS Fine!!!
But as soon as he wants to see how many rows was returned the recordcount
returns -1.
He gets this problem connecting using ODBC and OLEDB.

He gets the recordcount from the recordset object's recordcount property.

This is what I found on the MSDN online manuals:

RecordCount Property - ADO
Indicates the current number of records in a Recordset object.
Applies To
Recordset
Remarks
Use the RecordCount property to find out how many records are in a Recordset
object. The property returns -1 when ADO cannot determine the number of
records. Reading the RecordCount property on a closed Recordset causes an
error.
If the Recordset object supports approximate positioning or bookmarks - that
is, Supports (adApproxPosition) or Supports (adBookmark), respectively,
returns True - this value will be the exact number of records in the
Recordset regardless of whether it has been fully populated. If the
Recordset object does not support approximate positioning, this property may
be a significant drain on resources because all records will have to be
retrieved and counted to return an accurate RecordCount value.

When you work with linked TableDef objects, the RecordCount property setting
is always -1.

According to Microsoft, there are 3 reasons for this problem
1. ADO cannot determine number of records
2. Provider does not support recordcount
3. Cursor type does not support recordcount

ADO works if I query a SQL Server 7 Database
The cursor type is the same for a Sybase and SQL Server query.
The App works against MS Sql Server.
The only differece is the Provider

Here is the link
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
mdprorecordcount.asp

Use the RecordCount property to find out how many records are in a
Recordset object. The property returns -1 when ADO cannot determine the
number of records or if the provider or cursor type does not support
RecordCount. Reading the RecordCount property on a closed Recordset
causes an error.

Is the problem the OLEDB/ODBC driver or not?

Thanks!
N


0
nadine
4/18/2002 3:15:43 PM
sybase.connectivity.odbc 1822 articles. 0 followers. Follow

1 Replies
1440 Views

Similar Articles

[PageSpeed] 24

Maybe this is a little late, but i think that you have to do is change the 
cursortype: one of them does that with the recordcount


greetings
0
ruy
7/30/2002 2:59:09 PM
Reply: