Publishing problem of Path to database
Hi All,
I am new to C# programming.I have developed an application in C# that involves data retrieval from database, for which i used custom connection string as default one was not saving data permanently in database.
I am using MS Visual C#2010 Express.
so my code for connection was:
string conString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\PC\\Documents\\Visual Studio 2010\\Projects\\My_app\\My_app\\Myapp_records.mdf;Integrated Security=True;User Instance=True";
SqlConnection con = new SqlConnection(conString);
con.Open();
and so on.....
Now when i want to publish this application and run on some other pc, it cannot find path to my database and gives error.
Error:
An attempt to attach an auto-named database for file ****** myapp_records.mdf failed.
can Please some one recommend me solution so that, i can install my application on other PC's with database attached. or path to database can be mentioned in settings some where.
Thanks
Bilal Farooq