I am working on a Winforms project, and I am just setting up the setup file for the installation of the program.
Scenario
The connection string I have set for my use is like this:
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\Application\MyAppv1.0\MyApp\DB.mdf;Integrated Security=True");
return con;
Here, I use local DB from my personal location.
Question
On installation on the client's PC, the database is also attached, so the installed files will be on C:\Program Files\Author\MyAppv1.0
. When I use the same connection string, the app shows an exception. So, should I update my connection string for that location during the setup creation? (I am using MSI).
Is there any commonly followed approach for this scenario?
My aim is to make the installed app use the DB that is also on the same location of installation named DB.mdf
and is provided with setup.
Thanks guys in advance.