Datagridview database not updating
Probably everyone in the world but me knows how Visual Studio handles database files during testing in a GUI-based project. NET projects, I didn't clue into this behavior until recently.
But even if you do know about this "feature," you may not be aware of how you can improve on Visual Studio's default behavior.
And my thanks to my buddy Greg Adams, who explained it to me (he didn't have to draw me pictures, but it was a near thing).
You don't make changes to the database first and then update the grid.
And sure enough, when you go to Server Explorer and browse to the rows that should have been changed in the first run you can see that the data is unchanged.
That's because, when you press F5, Visual Studio quietly copies your database from your project's root folder to the bin/Debug folder, and that's the version of the database that your code updates.
Here's what happens: You add a database to some non-ASP. You run some code that makes some updates and everything seems to work with all of your updates accepted.
You then do a second run…and it's like your previous run never happened!
Search for datagridview database not updating:
Finally I was very happy to have Julia Kornich, a technical writer on the EF team, save the day!