S
Sean Aitken
Good morning,
I'm trying to update a DataSet based on data that has been modified in
a DataGridView. The DataSet isn't binded to the DataGridView because of
a couple conversions. (In this case, a time interval, or TimeSpan, is
stored as number of milliseconds). I haven't found an elegant way to
use the DataSource feature of the DataGridView and allow the
millisecond timespan representation to be displayed as a user-friendly
TimeSpan. To handle this disconnection, I'm simply creating a
DataTable that contains the data the way I want things to appear in the
DataGridView. This works well.
My problem is when I want to save the changes back to the database.
After the user makes a change to a cell and hits 'enter', the "New" row
below is highlighted (indicating that the change was performed on the
cell / row in question). Programatically, I read in the values from the
DataGridView.Rows[] collection. The values I find are the original
values from before the changes were made.
Is there some magic property I'm missing or certain way to get the
modified rows of a DataGridView? I have found nothing in the
documentation that sheds any insight. Should I just hold a reference to
a DataTable locally, bind THAT to the DataGridView, then just look at
the table for changes? Why aren't the Rows[] giving me my changes?
Thanks in a advance!
-Sean
I'm trying to update a DataSet based on data that has been modified in
a DataGridView. The DataSet isn't binded to the DataGridView because of
a couple conversions. (In this case, a time interval, or TimeSpan, is
stored as number of milliseconds). I haven't found an elegant way to
use the DataSource feature of the DataGridView and allow the
millisecond timespan representation to be displayed as a user-friendly
TimeSpan. To handle this disconnection, I'm simply creating a
DataTable that contains the data the way I want things to appear in the
DataGridView. This works well.
My problem is when I want to save the changes back to the database.
After the user makes a change to a cell and hits 'enter', the "New" row
below is highlighted (indicating that the change was performed on the
cell / row in question). Programatically, I read in the values from the
DataGridView.Rows[] collection. The values I find are the original
values from before the changes were made.
Is there some magic property I'm missing or certain way to get the
modified rows of a DataGridView? I have found nothing in the
documentation that sheds any insight. Should I just hold a reference to
a DataTable locally, bind THAT to the DataGridView, then just look at
the table for changes? Why aren't the Rows[] giving me my changes?
Thanks in a advance!
-Sean