Backing up datagridview for restore ability

DanielB33

Active member
Joined
Mar 29, 2013
Messages
40
Programming Experience
1-3
I use a datagridview to populate important data that may be accumulating for 6 months at a time. I would like to periodically back up the incoming data. If the system shuts off or similar, we can just restore the data. Since there might be thousands of rows and 11 columns, I hope to do this very efficiently. I want to back up the potentially 50 thousand data points every few minutes or hour without the user noticing. Anyone know how to do this?
 
This doesn't, or at least shouldn't, have anything to do with the DataGridView. Your question suggests that you are adding the data directly to the grid. I would suggest doing otherwise. I would suggest storing the data in some data structure that you then bind to the grid. Exactly what that data structure should be depends at least partly on where you want to save the data. If it's to a database then a DataTable would be the easiest option. If it's to a file then a collection of your own class would probably be better.
 
Hmmmm interesting ideas. The user needs to see the data. Often times they will just gather the data and look at in the grid, so I need to populate a grid of some sort. The user can also export the data to excel for analysis. Additionally, the user can select columns for tread line graphing. I want all of these features to stay in place....but I need to make sure I do not loose data as well. But I do need to add data directly to the grid (which is coming from a PCB designed in house)
 
I think that you've misunderstood my suggestion. I'm not suggesting that you don't use a grid and I'm not suggesting that the user not be able to enter data. What I'm suggesting is that, rather than you adding data directly to the grid in code, you add the data to a DataTable or some other data structure and that you then bind that to the grid. To the user there will be no difference but it means that you can work with the data source in code instead of the grid, e.g. you can create a Copy of the DataTable and then let a background task save that while the user carries on working with the grid as they normally would.
 
Back
Top