vs2012 error while connect to DB

  • hi

    I worked on a project with Visual Studio that I need to connect to my DB which is created in SQL server 2012.

    I make a connection in server explore in VS but when i select my db it give me an error that i don't have permission to access the file !

    I don't know what's wrong, even I try new instance in SQL but it doesn't work, and I use windows authentication in sql.

    it's really kind of u if u can help me about this. 🙂

  • What permissions do you have on the SQL instance and database?

    Connect to the instance using SSMS and confirm you can navigate the database objects, confirm your level of access at both the server and database level using an administrator login.

  • your Window User do not access to that particular DB. For the sake of connectivity you can use SQL Authentication Mode for that db.

  • i think it's full access, i mean i don't change any special thing...

    how can i check an instance access !?

    about SQL authentication, if i choose it in VS it's just ask me that username and password ?!

  • By default, windows admins do not get access to the SQL instance. You need to specifically grant access during installation. If you used the default during installation, you need an Administrator login to grant your windows user access to the instance via SQL management studio.

    This is the install screen where you initially grant who can administer the SQL instance:

    If you can get into SQL management studio and connect as administrator (or sa if you chose mixed mode authentication), then run:

    CREATE LOGIN [domain\user] FROM WINDOWS

    GO

    sp_addsrvrolemember 'sysadmin','domain\user'

    GO

    That's assuming this is a development instance. If you are setting up a production system, contact the owner for access.

  • thank for ur clearly explanation 😉

    i think it's work 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply