Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connecting to a Data Source
Message
From
22/05/2002 09:07:36
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Connecting to a Data Source
Miscellaneous
Thread ID:
00659853
Message ID:
00659853
Views:
44
This post refers to eMbedded Visual Basic 3.0. I am using this emulator with hopes of using the code on a pda.
I am trying to build a simple form with 1 command button and 1 text box. I want to attach to an Access Database and pull data from one of the tables. The syntax I am using is below. I keep getting "syntax error" but I don't know which line.

My goal is to:
ATTACH TO A DATABASE - D:\PDA.CDB
SELECT A FIELD FROM A RECORD IN A TABLE AND DISPLAY THAT FIELD IN TEXTBOX
THE TABLE IS - TABLE1
THE FIELD IS - NAME

Any Help would be appreciated
Option Explicit
Dim cnSample As ADOce.Connection
Dim rsSample As ADOce.Recordset


Private Sub Command1_Click()
End Sub

Private Sub Form_Load()


Set cnSample = New ADOce.Connection
cnSample.ConnectionString = "Source=d:\pda.cDB"
cnSample.Open
Set rsSample = New ADOce.Recordset
rsSample.Open "SELECT * FROM TABLE1", cnSample
Set Text1.DataSource = rsSample
Text1.DataField = "nAME"
End Sub

Private Sub Form_Unload(Cancel As Integer)

rsSample.Close
Set rsSample = Nothing
cnSample.Close
Set cnSample = Nothing
End Sub
Here's to alcohol...the cause of ... and solution to ... all of life's problems - - Homer J. Simpson
Next
Reply
Map
View

Click here to load this message in the networking platform