How do I connect to SQL Server using OLEDB using Windows Authentication connection string

穿精又带淫゛_ 提交于 2019-12-02 02:07:39

问题


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.

Here is the string:

data source=172.20.0.113;initial catalog=ForgeEnterprise;Integrated Security=SSPI;multipleactiveresultsets=True;App=EntityFramework

And here is the error:

Login failed for user 'MOMENTUMI\jmcclure'

Is there something I'm missing?


回答1:


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;

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.



来源:https://stackoverflow.com/questions/6913409/how-do-i-connect-to-sql-server-using-oledb-using-windows-authentication-connecti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!