PreviousOLE DB Provider Guide ( revision 1) Next

Connecting to a Database Using the OLE DB Provider

Show this topic in Library frames

When using the Pervasive OLE DB provider, a common question is how to connect to the database. This section details the basics of connecting using the OLE DB provider.

Connecting to OLE DB Provider

Connect String

"Provider=PervasiveOLEDB;Data Source=(DBName or Path to 
DataFiles)" 

Sample connection and open

Private Sub Form_Load() 
Dim cn As New ADODB.Connection 
Dim rs As New ADODB.Recordset 
'This should always be adUseServer unless you 
'specifically want to use the Client Cursor Engine 
cn.CursorLocation = adUseServer    
cn.ConnectionString = "Provider=PervasiveOLEDB;Data 
Source=Demodata" 
cn.Open 
rs.Open "Billing", cn, adOpenDynamic, adLockOptimistic, 
adCmdTableDirect 
rs.MoveFirst 
MsgBox "The first Student ID: " & 
rs.Fields("Student_ID") 
rs.Close 
cn.Close 
End Sub 

Other Tasks

Other common procedures are documented in Chapter 3, ADO/OLE DB Reference Information.


Chapter contents
Publication contents

Prev topic: Programming with the Pervasive OLE DB Provider
Next topic: Remote Connections