Sub CreateConnection()
'Declare and instantiate the connection
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
'Open the connection
cnn.Open "Provider=SQLOLEDB.1;" & _
"Data Source=(local); Initial Catalog=NorthWind;" & _
"User ID=sa;PWD="
'Close the connection
cnn.Close
'Destroy the connection object
Set cnn = Nothing
End Sub
|