Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO to VFP data using VB
Message
 
 
To
13/01/1999 21:39:43
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00175753
Message ID:
00175768
Views:
27
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...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform