如何使用Windows身份验证连接字符串使用OLEDB连接到SQL Server [英] How do I connect to SQL Server using OLEDB using Windows Authentication connection string
问题描述
我有在Windows身份验证模式下运行的SQL Server 2010,并且已分配了适当的组.我可以使用Windows身份验证通过SQL Server Client Studio进行连接.那个有效.但是,当使用.NET OLEDB连接进行连接时,它将失败,而且我不知道为什么.
I have SQL Server 2010 running in windows auth mode and the proper groups have been assigned. I can connect via the SQL Server Client Studio using windows auth. That works. But when connecting using .NET OLEDB connections it fails and I can't figure out why.
这是字符串:
data source=172.20.0.113;initial catalog=ForgeEnterprise;Integrated Security=SSPI;multipleactiveresultsets=True;App=EntityFramework
这是错误:
Login failed for user 'MOMENTUMI\jmcclure'
有什么我想念的吗?
推荐答案
根据 http://connectionstrings .com/sql-server-2008 这应该可以解决问题
According to http://connectionstrings.com/sql-server-2008 this should do the trick
Provider=SQLNCLI10;Server=172.20.0.113;Database=ForgeEnterprise;Trusted_Connection=yes;
其中Trusted_Connection与集成安全性显然相同.
Where Trusted_Connection is the same as Integrated Security apparently.
如果这不起作用,则应验证是否已在数据库的权限"选项卡(图片)中添加了该用户,但我想您已经这样做了.
If that doesn't work, you should verify that the user is added in the permissions tab (picture) for the database, but I guess you already did that.
这篇关于如何使用Windows身份验证连接字符串使用OLEDB连接到SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!