Cannot open database requested by the login. The login failed. Login failed for user ‘usename’.
SQL SERVER Add commentsWhile trying to establish connection with sql server database the following error may occur
Cannot open database requested by the login. The login failed. Login failed for user ‘usename’
The reasons for this error will be.
1. Invalid login credentials
2. The user do’t have permission to open the database
If the user do’t have permission follow the below steps
1. Go to SQL Server > Security >>Logins and right click on your username and select Properties
2. n newly opened screen of Login Properties, go to the “User Mapping” tab. Then, on the “User Mapping” tab, select the desired database – especially the database for which this error message is displayed. On the lower screen, check the role db_owner. Click OK.
Tags: asp.net, login failure, sql express, sql server 2005, sql server error, sqlconnection