OLE DB Provider and Visual Basic
This section helps you to integrate the PSQL OLE DB Provider into your Visual Basic development environment.
Non-Visual Programming
This procedure shows how to program in ADO and OLE DB without using the visual control objects.
1
2
3
4
5
Dim myData as New ADODB.Recordset
6
myData.CursorLocation = adUseServer
myData.Open "Person", "Provider=PervasiveOLEDB;Data Source=DemoData", adOpenDynamic, adLockOptimistic, adCmdTableDirect
7
Private Sub DisplayFields()
Text1 = myData.Fields(0)
Text2 = myData.Fields(1)
Text3 = myData.Fields(2)
End Sub
8
Private Sub Command1_Click()
myData.MoveFirst
DisplayFields
End Sub
 
Private Sub Command2_Click()
myData.MovePrevious
DisplayFields
End Sub
 
Private Sub Command3_Click()
myData.MoveNext
DisplayFields
End Sub
 
Private Sub Command4_Click()
myData.MoveLast
DisplayFields
End Sub
9
Command1_Click
10
11
12
Private Sub btnUpdate_Click()
myData.Fields(1) = Text2
myData.Fields(2) = Text3
End Sub
Visual Programming
The PSQL provider has one property that is essential for initialization, and that is Data Source. OLE DB providers do not use DSN’s, so the Data Source property should be set to a DBNames value. For example, the connection string for an ADO Connection::Open command would be "Provider=PervasiveOLEDB;Data Source=<data store>", where <data store> is a DBName.
1
2
3
Click the Project | Components menu option to display the components dialog.
4
5
6
Right click on the data control and select ADODC Properties from the pop-up menu
7
Click Build to bring up the connection string builder.
8
Select Pervasive OLE DB Provider from the list and click Next.
9
10
11
Click the RecordSource tab of the ADODC Properties dialog.
12
Change the command type to adCmdTable using the drop-down list.
13
14
15
Change the Data Source property to adodc1 using the drop down list.
16