Accessing a SQL Server database from Visual Studio

2019-07-30 15:57发布

问题:

I am using Visual Basic 2010 to write a front end to a database I created in SQL Server 2008. The problem I am having is when trying to add the SQL Server database as a new data source, I get the error message:

You don't have permission to open this file. Contact the file owner or an administrator to obtain permission

So is this a permission I need to set up in SQL Server to allow the connection from VB? If so, can someone please tell me what this is?

Really stuck with this, hoping to find an answer asap if possible.

回答1:

You can try open your Visual Studio as 'Administrator' and if it works, then the issue is with Visual studio.

Else it should be with your SQL Server. Try the below steps;

  • Right click on your database and choose Properties option.
  • In the pop up window, go to Option ad change the auto close option to true as shown below;



回答2:

check the permission in file for specific user.(Read/Write Access)