Update Data Table from Data Source
-
I need to update a datatable from a datasource silently. That is, I need to do regularly refresh data in datatable from its source database (MS Access database) without greatly interrupting the user experience. I don't want to clear the table and fill it from an OleDbDataAdapter, but use some other method. Any suggestions would be appreciated. Thanks.
-
I need to update a datatable from a datasource silently. That is, I need to do regularly refresh data in datatable from its source database (MS Access database) without greatly interrupting the user experience. I don't want to clear the table and fill it from an OleDbDataAdapter, but use some other method. Any suggestions would be appreciated. Thanks.
If you don't want that the UI goes to nonresponding state, use BackgroundWorker[^] class to fetch the data. When fetching the data n DoWork method, use OleDbDataAdapter, OleDbDataReader or what ever is suitable.
The need to optimize rises from a bad design.My articles[^]
-
If you don't want that the UI goes to nonresponding state, use BackgroundWorker[^] class to fetch the data. When fetching the data n DoWork method, use OleDbDataAdapter, OleDbDataReader or what ever is suitable.
The need to optimize rises from a bad design.My articles[^]
Thanks, Mika. I had thought of a BackgroundWorker, but I was also hoping to retrieve updates while preserving any changes the user was making to the current DataTable. The DataTable.Merge(DataTable) method, where the DataTable passed into the method reflects the current state of the database) seemed like a good option to me, but I have not been able to get the Merge method to work. If you have any suggestions regarding how to use the Merge method, or any relevant articles to point me to, I would appreciate it. Thanks.
-
Thanks, Mika. I had thought of a BackgroundWorker, but I was also hoping to retrieve updates while preserving any changes the user was making to the current DataTable. The DataTable.Merge(DataTable) method, where the DataTable passed into the method reflects the current state of the database) seemed like a good option to me, but I have not been able to get the Merge method to work. If you have any suggestions regarding how to use the Merge method, or any relevant articles to point me to, I would appreciate it. Thanks.