Database Connection Strings

ODBC DSN
=========
oConn.Open "DSN=AdvWorks;" & _
"UID=Admin;" & _
"PWD=;"

ODBC DSN-less connection
========================
oConn.Open _
"Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\somepath\mydb.mdb;" & _
"Uid=Admin;" & _
"Pwd=;"

OLEDB Access
============
oConn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\somepath\mydb.mdb;" & _
"User Id=admin;" & _
"Password=;"

OLEDB SQL Server
================
oConn.Open _
"Provider=MSDASQL;" & _
"Driver={SQL Server};" & _
"Server=carl2;" & _
"Database=pubs;" & _
"Uid=sa;" & _
"Pwd=;"

Source: Unknown
Viewed 5472 times