This is a problem that has plagued me for a while now. Let's say I create a Windows Forms C# application. Then I add a "Service Based Database" to the project. Then I create tables, populate them, yada yada. Then I connect the database to the project click on "project" then "add a new data source" etc... Then I get my connection string and add it to the code. I also changed the "Copy to Output Directory" property of the .mdf file to Copy if Newer even though I don't know what that means.
During run time, if I were to add data to the database, It will be saved. But if I open up a query file and directly search for that new data in the MDF file, it will not be there. Online research shows me that it's because a temporary database file is made whenever I build the app. How do I make it so that the data is copied into the .mdf file itself and not a temporary database file?
edit: this is the connection string:
<connectionStrings>
<add name="myDB" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\constructionDatabase.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>