Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO to VFP data using VB
Message
From
14/01/1999 15:16:15
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00175753
Message ID:
00176160
Views:
34
John,

Thanks for your help. It seems to work fine, however, it brings up
a couple of other questions:

1. Even though the code works, the SUPPORTS property
returns FALSE for APPROXPOSITION. Doesn't that mean
that references to ABSOLUTEPOSITION should fail also?
(They don't - except as in question #2)

2. The code works only if the CURSORLOCATION is server side.
If the CURSORLOCATION is client side, MOVELAST,
MOVEFIRST, ABSOLUTEPOSITION, and any reference to
RECORDCOUNT fails. Any idea why?

3. In general, what are the pros and cons of server side versus
client side cursors?


>Hi Craig....
>
>You are making this harder than it needs to be. Here is some modified code:
>
>' Declare these in the general declarations section of the form
>
>Option Explicit
>Dim conn As New adodb.connection
>Dim rs As New adodb.connection
>
>
>Dim connectionstring As String
>Dim SQLString As String
>
>ConnectString = "DRIVER=Microsoft Visual FoxPro Driver;" & _
>"UID=;SourceType=DBC;Exclusive=No;" & _
>"BackgroundFetch=Yes;Collate=Machine;" & _
>"SourceDB=c:\logbook\logbook.dbc """
>
>SQLString = "Select * from Mission"
>
>'Open connection
>conn.Open (ConnectString)
>
>' open recordset object
>With rs
> .CursorType = adOpenStatic
> .Source = SQLString .ActiveConnectin = conn
> .LockType = adLockBatchOptimistic
> .Open
>EndWith
>
>
>Declare the conn an rs objects in the general declarations section of the form. This will provide scope throughout the form. Also, every client-side ADO Recordset is a static cursor type. Therefore, you do not need to declare that property specifically. Also, I suggest using batch optimistic locking. You were performing a lot of extra work with creating the recordset via the execute method - only to close and reopen. This may be the issue. I can tell you that the OLE-DB Provider for ODBC does indeed support MoveLast, MoveFirst, MoveNext, MovePrevious, etc.... One thing you will need to watch out for is Numeric Types. With Client-Side cursors - you will need to make those fields Double-Precision types.
>
>Also, VB supports strong typing. Take advantage of it by using Option Explicit and explicitly declaring each variable.
>
>Let me know how things go...
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform