I have VBA code that uses a connection string to talk to an SQL Server. I would like to use an external DSN file for this connection, purely for the adaptability.
The current code:
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
strConn = "DRIVER=SQLServer;SERVER=x;APP=Microsoft Excel;DATABASE=x;Trusted_Connection=Yes"
cn.Open strConn
The code works, but for our users a dsn file would be more appropriate.
The .DSN File:
[ODBC]
DRIVER=SQL Server
Database=x
APP=Microsoft Office 2013
Trusted Connection=Yes
SERVER=x
Description=x