这个错误使我发疯 [英] This Error drives me crazy

查看:116
本文介绍了这个错误使我发疯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我用VB.NET编写了一个程序
运行程序时出现此错误
用户""登录失败.该用户未与受信任的SQL Server连接关联."

如何解决此错误????
请帮助我.

Hi guys
I wrote a program in VB.NET
I got this error when i run the program
"Login failed for user ''''. The user is not associated with a trusted SQL Server connection."

How can solve this error ???
please help me.

推荐答案

看看这个:
Have a look at this:
http://blogs.msdn.com/b/sql_protocols/archive/2008/05/03/understanding-the-error-message-login-failed-for-user-the-user-is-not-associated-with-a-trusted-sql-server-connection.aspx[^]

Good luck!


运行该应用程序的人没有对SQL数据库的权限,您的连接字符串中提到了Trusted Connection.

更改连接字符串以删除受信任的连接"并向数据库提供有效的用户名和密码,或者将userId添加到数据库的安全性"(仅基于域的网络!)

我强烈建议您先阅读SQL Server安全性,然后再继续...
The person running the app doesn''t have permissions to the SQL database and your connection string mentions Trusted Connection.

Either change the connection string to remove Trusted Connection and supply a valid username and password to the database or add the userId to the database''s Security (domain-based networks only!)

I would HIGHLY suggest reading up on SQL Server security before proceeding though...


我有这个代码的人

Guy''s I''ve this code

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim cnStrBuilder As New SqlConnectionStringBuilder()
       cnStrBuilder.InitialCatalog = "FirstSQLDB"
       cnStrBuilder.DataSource = "WIN-H08I7LJ7JEA\SQLEXPRESS"
       cnStrBuilder.ConnectTimeout = 30
       Dim cn As New SqlConnection()
       cn.ConnectionString = cnStrBuilder.ConnectionString
       cn.Open()
       Dim strSQL As String = "Select * From Employee_Info"
       Dim myCommand As New SqlCommand(strSQL, cn)
       Dim reader As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
       TextBox1.Text = reader(1).ToString()
   End Sub



Evey tome我运行它,我遇到了相同的错误
用户""登录失败.该用户未与受信任的SQL Server连接关联."

我做了很多事情,但是我没有工作
请帮忙??



Evey tome I run it, I got the same error
"Login failed for user ''''. The user is not associated with a trusted SQL Server connection."

I did a lot of things but i doesn''t work
Please Help ??


这篇关于这个错误使我发疯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆