While using AttachDbFileName in the connection string to attach database to localdb,The following error occurs
Error: The logical database file 'Common WM_log' cannot be found. Specify the full path for the file.
Could not open new database 'C:\USERS\SOURCE\REPOS\WINDOWSAPP20\WINDOWSAPP20\BIN\DEBUG\COMMON.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file C:\Users\source\repos\WindowsApp20\WindowsApp20\bin\Debug\common.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Here is the connection String that we are currently using.
Private connectionString As String = "Data Source=(localdb)\v11.0;AttachDbFileName=E:\common WM.mdf;Integrated Security =true;"
Please note that the mdf files were from SQL Server 2008
Tried placing the mdf ldf files in application path in C drive also. It did not work.
When Create database ..For attach or sp_attach_db is used for same mdf file and localdb , it works .
Why is it not working in AttachDbFileName ?