To create an OLE DB Provider connection object

Use Visual Basic, C#, or another OLE DB-compliant resource to create a connection object.The following code exemplifies creating a connection in Visual Basic:

 

Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
 
cnn.Open  "Provider=CONNXOLEDB;Persist Security Info=True;prompt=NoPrompt;User ID=theuser;Password=thepass;Data Source=C:\connx32\utils\CONNX.cdd;Mode=ReadWrite"
    
SQL = "SELECT orderid, customerid, productid, orderdate, productquantity FROM orders_rms"
        
rs.Open SQL, cnn
   

or in .NET:

 
Dim cnn As OleDbConnection
Dim cmd As OleDbCommand
Dim sqlda As OleDbDataAdapter
Dim sqlds As DataSet
 
cnn = New OleDbConnection("Provider=CONNXOLEDB;Persist Security Info=True;prompt=NoPrompt;User ID=theuser;Password=thepass;Data Source=C:\connx32\utils\CONNX.cdd;Mode=ReadWrite")
 
SQL = "SELECT orderid, customerid, productid, orderdate, productquantity FROM orders_rms"
 
cmd  = New OleDbCommand(SQL, cnn)
sqlda = New OleDbDataAdapter(cmd)
sqlds = New DataSet
sqlda.Fill(sqlds)