Is it possible to submit changes to the actual database when debugging C # in Visual Studio?

I am creating a C# application using Visual Studio using SQLExpress database. When I click f5 to debug the application and make changes to the database, I believe what is happening is bin/debug There is a copy of the database in the folder that is making changes.

However, when I stop debugging and then press f5 the next time I put a new copy of the database into the bin/debug folder, so that the last time All the changes made are gone.

My question is:

Is there a way, when I debug the application, I can make it make changes to the actual database Are these changes actually saved, or will it only change the copy in the bin/debug folder (if this is what actually happened)?

I have seen similar questions, but I cannot find an answer as to whether it is possible to make these changes persistent in the actual .mdf file.

The reason I asked It’s because when I build this app, I keep adding parts and tests to make sure they work together. When I enter the test data, I use the actual data that I want to keep in the database. This will only help me not have to in the future Re-enter the data.

Thanks in advance for any help or information that will help me better understand the process.

Select the database in the Solution Explorer, and then change “Copy to output directory” to “Copy if updated”. Later, when you finally get the final version, please debug Copy and paste the database in the folder to the source folder

I am creating a C# application using Visual Studio using SQLExpress database. When I click f5 to debug the application and make changes to the database , I believe what is happening is that there is a copy of the database in the bin/debug folder that is making changes.

But when I stop debugging and then put a new copy of the database into the bin next time /debug folder, press f5, so that all the changes made last time are gone.

My question is:

Is there a way when I debug the application Can I make it make changes to the actual database when these changes are actually saved, or it will only change the copy in the bin/debug folder (if this is what actually happened)?

I have seen similar questions, but I cannot find an answer as to whether it is possible to make these changes persistent in the actual .mdf file.

The reason I asked It’s because when I build this app, I keep adding parts and tests to make sure they work together. When I enter the test data, I use the actual data that I want to keep in the database. This will only help me not have to in the future Re-enter the data.

Thanks in advance for any help or information that will help me better understand the process.

In the solution Select the database in the Explorer, and then change “Copy to output directory” to “Copy if updated”. Later, when you finally get the final version, please copy and paste the database in the debug folder to the source folder< /p>

Leave a Comment

Your email address will not be published.