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

前端 未结 4 694
离开以前
离开以前 2021-02-14 11:37

Is there a way to have Excel connect to Sql Server using the current user\'s network windows authentication (trusted connection/integrated security)? I don\'t want to rely on a

4条回答
  •  逝去的感伤
    2021-02-14 11:49

    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
    

提交回复
热议问题