954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

SQL not a trusted connection?!

Hi all, I'm getting this error when I try to link to my SQL database :(.

Login failed for user 'test' Reason: Not associated with a trusted SQL Server connection.

any ideas what I'm doing wrong?

Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
 

What's your connection string?

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

I've fixed it now... I used the "Trusted_connection=yes;" now it said login failed for user DOMAIN\ASPNET so I just made an account called ASPNET :( Althought I would have liked to see if I could make it so it logged in using my sql authentication...


My connection String is:

Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
 

"Server=.;Database=sladesfaculty;User ID=username;Password=password"

^ Should work fine. Also, you need to make sure your SQL Server is set for SQL Server Authentication (and not just Windows Authentication). Just because you've made SQL Server Authentication usernames and passwords doesn't mean its set properly.

In SQL Server Enterprise Manager, right click on your server, and go to properties. On the "Security" tab, make sure the "SQL Server and Windows" radio button is selected.

FYI, the "." is a shortcut for localhost in an SQL Server connection string :cool: .

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

that was my original string. I also used sql & windows authentication but it didn't work, not even when I have the username and password as my actual windows authentication... it still said it wasn't a trusted connection. Any ideas?

Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
 

If you want to use Windows authentication in ASP.NET, you can't just put in your DOMAIN\USER and password. You need to enable a trusted connection and use identity impersonation on your web application (or enable the ASPNET account on your database).

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You