简体   繁体   English

如何为连接字符串aceess设置sql server用户?

[英]how setup sql server user for connection string aceess?

probably something trivial but I cannot figure it out. 可能有些琐碎,但我无法弄清楚。 I created database in SQL Server 2012 and want to be able access it through connection string (excel vba code) from other computers like that: 我在SQL Server 2012中创建了数据库,希望能够通过连接字符串(excel vba代码)从其他计算机访问该数据库,如下所示:

con.Open "Provider=SQLOLEDB;Data Source=SQLSRV01;Initial Catalog=TESTDB ;User Id=test; Password=xxx"

I created user test on sql server and gave him read rights etc and I got runtime error login failed for user test. 我在sql服务器上创建了用户测试,并给了他读取权限等,并且运行时错误登录失败,无法进行用户测试。 What privileges should have such user? 这样的用户应具有哪些特权? Should be a windows user as well? 也应该是Windows用户吗? thanks 谢谢

使用更通用的连接字符串构造并收紧字符串声明(删除尾随空格)。

con.Open "Driver={SQL Server};Server=SQLSRV01;Database=TESTDB;UID=test;PWD=xxx;"

如果您在本地计算机上运行SQL Server,请尝试将SQLSRV01更改为。\\ SQLSRV01。

I knew it was going something trivial, this sql serer instance was configured as windows authentication only. 我知道这样做很简单,此sql serer实例仅配置为Windows身份验证。 I have change to both windows ans sql and works. 我已经更改为Windows ans sql和工程。 thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM