Ловлю ошибку
System.Data.SqlClient.SqlException (0x80131904): An attempt to attach an auto-named database for file C: \Users\dayover\documents\visual studio 2015\Projects\TestApp\TestApp\TestDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C: \Users\dayover\documents\visual studio 2015\Projects\TestApp\TestApp\TestDB.mdf;Integrated Security=True";
Искал в интернете, пишет надо:
Data Source=.\SQLEXPRESS;Database=myuniquedb;AttachDbFilename=|DataDirectory|\Base.mdf;Integrated Security=True;User Instance=True
Получаю ошибку:
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Путь брал из : обозреватель серверов->Моя база -> Свойства -> Строка подключения.
AttachDbFilename=C:..\TestDB.mdf;
указатьInitial Catalog=TestDB;
работает?