Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 A connection Question

Author  Topic 

nomadsoul
Yak Posting Veteran

89 Posts

Posted - 2007-05-26 : 11:32:33
Good day all,
I'm making a form in VB.Net with a button to check the connection:
With which I made a Try-Catch routine to narrow the problem. My Messagebox error is:

Login failed for user " . The user is not associated with a trusted SQL Server connection

I'm just using Windows Authentication without any Server UID or Password. Question: Am I leaving something out of the connection string? If so what? Here's the sqlConn event:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sqlConn As New SqlClient.SqlConnection
sqlConn.ConnectionString = "SERVER=NOMADSOUL\SQLEXPRESS;DATABASE=pubs"
Try
sqlConn.Open()
Catch sqlError As Exception
MessageBox.Show(sqlError.Message, "Connection Error")
End Try
End Sub

It is better to be prepared and not have an opportunity than to not be prepared and have an opportunity

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-26 : 11:52:24
add
Integrated Security = SSPI
to the connection string

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

nomadsoul
Yak Posting Veteran

89 Posts

Posted - 2007-05-26 : 13:27:36
By golly that fixed it.
Thanks for that, and have a great day.

It is better to be prepared and not have an opportunity than to not be prepared and have an opportunity
Go to Top of Page
   

- Advertisement -