I am new to c# and MS SQL databases.
I have created a database called Rulesdb2 and have attached it to my c# application. I had previously attached it as a local database but have changed this to a direct connection by specifying NO to "Copy the file to your project" prompt
Below is my connection string:
Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Rulesdb2.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True
However when I run the application I get an error indicating that the application is looking for the database in debug\bin directory as shown below.
"An attempt to attach an auto-named database for file C:\Users\User\documents\visual studio 2010\Projects\RBS07\RBS07\bin\Debug\Rulesdb2.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."
Can someone explain where I am going wrong ?