Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADODB RecordSet RecordCount Question
Message
From
24/12/1999 16:12:59
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
24/12/1999 15:40:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00308445
Message ID:
00308451
Views:
25
>I am using the following in VFP6 to pull records from a SQL Server 7 database.
>
>oConn=CREATEOBJECT("ADODB.Connection")
>WITH oConn
> .Provider = "SQLOLEDB.1"
> .ConnectionString = " Persist Security Info = False;User ID = sa;Initial Catalog = Portfolio;Data Source = SCM_TWO2"
> .Open
>ENDWITH
>
>lcselectstr = A very long SQL Statement
>oRs=CREATEOBJECT("ADODB.RecordSet")
>oRs.Open(lcselectstr,oConn,3,4)
>?oRs.RecordCount
>
>The data comes over just the way I want it but the RecordCount Property of the RecordSet Object returns a value of -1.
>Any ideas why this occurs?


As an addition to John, KB-Q194973 says :
"When you request the RecordCount for a serverside recordset, a -1 may return. This occurs with ActiveX Data Objects (ADO) version 2.0 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. "

It says this happens on serverside. CursorLoaction set to adUseClient returns correct results. Hope this helps.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform