I have a database file (FinanceDB.mdf) stored on the local harddrive. I can connect to the file, but when I execute queries to it through C#, I get the following error:
An attempt to attach an auto-named database for file F:\IT7x01Project\App_Data\FinanceDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
I have set the permissions for everyone on the file to full access which I thought may be part of the problem, but it turns out that its not (unless there is more to it than just setting the permissions).
This is the connection string:
<add name="FinanceDBConnectionString1" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=F:\IT7x01Project\App_Data\FinanceDB.mdf;Integrated Security=True;" providerName="System.Data.SqlClient"/>
Any help with this would be appreciated.