An attempt to connect a database with auto-name for the xxxx file failed

I have a database file (FinanceDB.mdf) stored on a local hard drive. I can connect to the file, but when I execute requests to it through C #, I get the following error:

An attempt to connect a database with auto-name for the file F: \ IT7x01Project \ App_Data \ FinanceDB.mdf failed. A database with the same name exists or the specified file cannot be opened or is located on a UNC share.

I set the permissions for all in the file to full access, which, as I thought, may be part of the problem, but it turns out that it does not exist (unless it’s just like setting 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.

+4
source share
2

<add name="Connec" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=C:\USERS\dL\DESKTOP\DATABASE\MYSHOP.MDF;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False" providerName="System.Data.SqlClient"/>

()

User Instance true.

User Instance=True

, , , .

+1

<add name="Connections" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>

we.config

-1

All Articles