Question

Why are database records lost when I'm debugging the winforms application? When I start the debugging app, records are saved into the database, but when it is restarted, all of the database records are lost and the database tables are empty. How can I debug an application without losing the data?

Was it helpful?

Solution

Are you sure the database is actually being updated? Have you checked with something other than the program you're debugging?

Is there perhaps a transaction that you are not committing?

Edit in reply to your comment

It sounds like maybe you need to change the properties of your database file in your Visual Studio solution - turn off "Copy to output folder".

OTHER TIPS

It sounds like you might be adding the records in a transaction and then not committing it. When you exit from the application (debugging session), the transaction is rolled back, and all your changes are lost.

Click on database. Go to properties. Select "Copy if newer".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top