Three Ways to Open an ADO Connection Object

In each connection recipe, one of the following methods is used to open the ADO Connection object. This topic uses connection scenarios and sample code to introduce you to each method.
Samples That Illustrate Three ADO Connection Methods
Method
Connection Scenario and Sample Code
Specify the Connection object properties in a one-line, quoted connection string.
You are using the most recently installed version of the SAS/SHARE provider to open a read-only connection to a remote server that requires user authentication.
Dim obConnection As New ADODB.Connection

   obConnection.Open "Provider=sas.ShareProvider; _
      Data Source=shr1;Mode=adModeRead; _
      Location=ShareServer.example.com; _
      User ID=tjones;Password=e7tjb" 
Set the Connection object ConnectionString property and then call the Open method without specifying any parameters.
The SAS 9.2 version of the IOM provider is being used to open a bridge connection to a remote server with host authentication.1
Dim obConnection As New ADODB.Connection

   obConnection.ConnectionString = "Provider=SAS.IOMProvider.9.2; _
   Data Source=iom-bridge://workspace.example.com:8591; _
   User ID=tjones;Password=e7tjb"
   obConnection.Open
Set the Connection object Provider property and then set individual property values by using the Connection objects Properties collection.
You are using the most recently installed version of the local provider to open a local connection to a SAS Version 6 data set located in c:\v6data.
Dim obConnection As New ADODB.Connection

   obConnection.Provider = "sas.LocalProvider"
   obConnection.Properties("Data Source") = "c:\v6data"
   obConnection.Properties("SAS File Format") = "V6"
   obConnection.Open
1This sample code uses the Data Source URI format.