【问题标题】:MS Access connecting with Windows Username to SQL ServerMS Access 使用 Windows 用户名连接到 SQL Server
【发布时间】:2012-02-13 15:01:49
【问题描述】:
Dim Cnxn As ADODB.Connection
Set Cnxn = New ADODB.Connection
With Cnxn
  .Provider = "MSDataShape"
  .Properties("Data Provider").Value = "SQLOLEDB"
  .Properties("Data Source").Value = dbserver
  .Properties("User ID").Value = Username
  .Properties("Password").Value = password
  .Properties("Initial Catalog").Value = dbname
  .CommandTimeout = 120
  .ConnectionTimeout = 120
  .Open
End With

以上是我如何从 MS Access 连接到 SQL Server,其中用户名是默认 SQL 用户名。但是,我想使用 Windows 用户名连接,但没有时间在 SQL Server 上创建 100 个用户名,每个 Windows 用户一个。有这样做的好方法吗?这是出于审计目的,所以我知道谁做了什么。

【问题讨论】:

    标签: sql-server sql-server-2005 ms-access vba ms-access-2003


    【解决方案1】:

    删除Properties UserIDPassword,并用Integrated Security 替换为true

    .Properties("Integrated Security").Value = true
    

    *T 可能是true 的大写字母

    【讨论】:

    • 并确保数据库服务器知道登录信息,或者最好还是用户所属的组。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    • 2022-12-17
    • 1970-01-01
    • 2012-12-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多