如何解决SQL Server登录失败错误 [英] How to solve SQL Server login failed error
本文介绍了如何解决SQL Server登录失败错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图通过我的c#应用程序连接到sql server。但我面临一个错误登录失败。
这是我的连接字符串:
数据源= ADMIN-PC;初始目录=样本;集成安全性=真
我的sql server 2005处于Windows身份验证模式。
请帮我解决这个问题。
谢谢。
Hi,
I am trying to connect to sql server through my c# application. But i m facing an error "login failed".
Here is my connection string:
"Data Source=ADMIN-PC;Initial Catalog=Sample;Integrated Security=true"
My sql server 2005 is on windows authentication mode.
Please help me out to solve this problem.
Thank you.
推荐答案
这是在C#中编写连接字符串的正确方法
Here is the correct way to write connectionstring in C#
<connectionstrings>
<add name="dbconnection" connectionstring="Data Source=SureshDasari;Integrated Security=true;Initial Catalog=MySampleDB" providername="System.Data.SqlClient" />
</connectionstrings>
确保运行您的代码的帐户可以访问数据库。 Google使用sql server配置Windows安全性。
Make sure the account your code is running under has access to the database. Google for configuring windows security with sql server.
这篇关于如何解决SQL Server登录失败错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文