Laziale
Laziale

Reputation: 8225

can't connect to sql database from visual studio

I am working on asp.net website with sql database which provides membership support. After the membership module and the database were created I attached the database to my local sql server. I am having mixed mode for authentication in the sql server, and I am authenticated with my sql server login credentials at this moment. Now, when I am trying to establish connection from my asp.net solution I am getting this error:

Cannot open user default database. Login failed. Login failed for user 'username'.

Any advice? Thanks in advance, Laziale

Upvotes: 0

Views: 1219

Answers (1)

Gregory A Beamer
Gregory A Beamer

Reputation: 17010

You have an incorrect connection string for the database in question. A good resource, for setting up connection strings, is connectionstrings.com. The best way to fix this is log directly into SQL Server and make sure you have a user/password combo that works. Once you do that, you can use that combo in the connection string.

Since this is local, you should not have other problems, but one possibility to look into, esp. with SQL logins, is making sure the TCP protocol is enabled in SQL Server for connection. The "login failed" error message indicates this IS NOT your current problem, however.

Upvotes: 1

Related Questions