2

I am getting following error each time I tried to select database. The database 'DB Name' is not accessible. (Microsoft.SqlServer.Express.ObjectExplorer)

Note: My OS is Win Vista.

When I tried to open SQL Mgmt Studio as Run as administrator than I can able to access database properly.

Any idea why it is giving error.

I am also getting following error when my asp.net application is trying to access database.

Cannot open database "DBName" requested by the login. The login failed. Login failed for user 'PCName\abcd'.

I am not very good with SQL Server, please let me know how to create user and grant them permission in case that is what causing the problem.

Thanks.

1

1 Answer 1

5

This is a permissions issue. When you run SSMS as administrator, you have access to everything. Your ASP.NET app is (and should be) connecting with a different user account, and does not have that access.

Create a new login in SQL server for your application, with its own username and password.

Add that login to your database DbName (under the \databases\DbName\security in SSMS) and give it the correct permissions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.