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?

What's your connection string?

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:
<add key="strSqlConnectionString" value="server=localhost;database=sladesfaculty;Trusted_Connection=yes;" />

"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: .

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?

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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.