Excel VBA - connect to sql with a trusted connection (no uid/pwd) Excel VBA - connect to sql with a trusted connection (no uid/pwd) vba vba

Excel VBA - connect to sql with a trusted connection (no uid/pwd)


I have this connectionstring in an Excel 2003 VBA project...

"Provider=SQLOLEDB;Data Source=[You DB Name];Trusted_connection=yes;"

And it works for me! (I'm using ADODB)


Driver={SQL Native Client};server=servernamehere;database=dbnamehere;Trusted_Connection=yes;

http://www.sqlstrings.com/SQL-Server-connection-strings.htm

http://www.connectionstrings.com/sql-server

Try this one:

Provider=sqloledb;Data Source=myServerName;Initial Catalog=myDatabaseName;Integrated Security=SSPI


See: http://www.connectionstrings.com/

Especially http://www.connectionstrings.com/sql-server-2005, for example:

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

or any other suitable connection string you find there.