I'm doing a program using C # in WPF, and I need to access the database dynamically, in this case I'm using a .mdf file. In code I have the connectionString like this:
string stringConexao = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=E:\PAP\Trabalhos\Trabalhos\Trabalhos.mdf; Integrated Security=True";
I want to replace "E: \ PAP \ Jobs \ Jobs \ Jobs.mdf" with a dynamic way to find the database, so that I can then use the program outside of my computer.
The first "\ Jobs \" corresponds to where "Jobs.sln" is, the other folder "Jobs" and "packages". In the next folder is where you have all the .cs, .xaml, etc.
One of the solutions I found was to put the database inside Debug, however I do not think it's the right way to do it.
Thanks in advance.