Creating a SQL Server Connection Object with Integrated Security
Sub CreateConnectionIntegrated()
'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;" & _
"Integrated Security=SSPI"
'Close the connection
cnn.Close
'Destroy the connection object
Set cnn = Nothing
End Sub
Related examples in the same category