从 C# 连接到 SQL Server 2008

发布于 2024-11-11 08:00:40 字数 183 浏览 4 评论 0原文

我在登录时遇到问题。我在SQL Server 2008中创建了一个数据库。在Visual Studio 2010中运行我的软件时附加数据库后,我的软件登录失败。它说

用户名或密码无效”

而在我的另一台电脑上,该软件运行正常。

我无法理解这个问题。

I am having problem in login. i have made a database in SQL Server 2008. After attaching the data base when i run my software in visual studio 2010, the login of my software fails. it says

Invalid user name or password"

while on my other PC the software is working fine.

i am not able to understand the problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

终陌 2024-11-18 08:00:40

如果您的凭据很好,并且连接字符串正确,请尝试将 sql server 2008 从 Windows 身份验证模式交换到选项中的 sql 混合模式,我相信在安全性下。

If your credentials are fine, and connection strings are correct try swapping in sql server 2008 from windows authentication mode to sql mixed mode which is found in options, I believe under security.

樱花坊 2024-11-18 08:00:40

基本上,您的登录信息在您当前的 PC 上无效,很可能是因为 SQL 安全设置。

也许它允许来自您的另一台计算机的可信连接,但不允许来自这台计算机的可信连接。

解决方案是修复 SQL Server 设置。最简单的方法是创建一个 sql 用户名并为其授予适当的权限,然后使用此用户名而不是可信连接或 NT 授权连接到服务器。最后一部分要求您添加

;UserId=...;Password=...

到连接字符串中。

Basically, your login information is invalid on your current PC, most likely because of the SQL security settings.

Perhaps it allows a trusted connection from your other computer, but not from this one.

The solution is to fix your SQL server settings. The easiest way would be to create an sql user name and give it the proper permissions, then connect to the server using this user name instead of a trusted connection or NT authorization. The last part requires you to add

;UserId=...;Password=...

to your connection string.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文