jdsanders24
New member
- Joined
- Oct 17, 2014
- Messages
- 4
- Programming Experience
- 10+
Hello,
I have a question about updating a datagrid with changes from a SQL server. I have a application (Multiple instances running across a network) that polls a server every so often and pulls data from a table to update a datagrid with changes that have been made to the table. The current implementation I have is as follows:
1.) Application Pulls data from server and creates new datatable
2.) Application records current selection in datagrid.
3.) Change datagrid ItemsSource to the new datatable that was retrieved.
4.) Set the selection back to the item that was selected before the itemsource was changed.
-This all is executed using a secondary thread as to not interrupt the UI thread.
It works flawless and the update process doesn't cause any flicker but I feel like there was a more direct approach without having to have as much code, also kinda nervous about it I have more than a few hundred rows if I will start noticing performance issues. (Which I should never have more than 50 rows at any given time giving consideration to how the application is being used, just want to plan ahead for the future.)
Do you feel like what I currently have is sufficient enough? or could you point to a article on the best way to accomplish a way to synchronize two datatables (New one from server against the current one Im using to display the data in a datagrid).
Development Information: WPF Vb.net, Framework 4.0, MSSQL
I have a question about updating a datagrid with changes from a SQL server. I have a application (Multiple instances running across a network) that polls a server every so often and pulls data from a table to update a datagrid with changes that have been made to the table. The current implementation I have is as follows:
1.) Application Pulls data from server and creates new datatable
2.) Application records current selection in datagrid.
3.) Change datagrid ItemsSource to the new datatable that was retrieved.
4.) Set the selection back to the item that was selected before the itemsource was changed.
-This all is executed using a secondary thread as to not interrupt the UI thread.
It works flawless and the update process doesn't cause any flicker but I feel like there was a more direct approach without having to have as much code, also kinda nervous about it I have more than a few hundred rows if I will start noticing performance issues. (Which I should never have more than 50 rows at any given time giving consideration to how the application is being used, just want to plan ahead for the future.)
Do you feel like what I currently have is sufficient enough? or could you point to a article on the best way to accomplish a way to synchronize two datatables (New one from server against the current one Im using to display the data in a datagrid).
Development Information: WPF Vb.net, Framework 4.0, MSSQL
Last edited: