This is what I am trying to achieve:
- DataTable populated using data from non database source
- This table is bound to a DataGridView using BindingSource
- The DataGridView is updated by the user, so that some cells now have new values.
- Because the table is bound to the datagridview its values are updated.
How do I get only the updated rows(the rows which have been edited) in the grid/datatable?
I have tried :
DataRow[] updatedRows =
_table.Select(null, null, DataViewRowState.ModifiedCurrent);
But this always returns 0 rows. Is there a way to get only the modified rows?
Worst case:
- Keep a copy of the original table
- Get the new table from the datagridview datasource
- Compare all rows.
Thanks!
Best Answer
How about this:
You can find more details at How to: Retrieve Changed Rows