V
Van T. Dinh
****Untested****
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.Open "Provider=SQLOLEDB; Server={YourServer};" & _
"Database={YourDatabase};" & _
"uid={UserName}; pwd={Password}"
'(above is for SQL Server Authentication)
Replace the last line with:
"Trusted_Connection=Yes"
for MS Windows NT Authentication.
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.Open "Provider=SQLOLEDB; Server={YourServer};" & _
"Database={YourDatabase};" & _
"uid={UserName}; pwd={Password}"
'(above is for SQL Server Authentication)
Replace the last line with:
"Trusted_Connection=Yes"
for MS Windows NT Authentication.