Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > What event to use to commit database changes in DataGridView?
 

What event to use to commit database changes in DataGridView?

I'm binding a dataset to a DataGridView at runtime and all the data is displaying fine. The tricky part is getting the changes back to the database. I'm the not sure what event to implement a handler for to get the changes back to the database. I've used CellValidated, but cannot figure out to verify if the cell is dirty, as can only seem to see IsCurrentCellDirty. Even if that is the case, the DataBoundItem, which is the DataSet row, has the new values but the RowState == DataRowState.Unchanged. So when I call the tableadapter update, nothing happens.

If I manually force the row by calling SetModified, it seems to reset the rows values to whats in the database.

I'm sure I'm missing something really simple, so in summary, can someone tell me what event handler I need to implement to submit changes back to the database.

Thanksin advance.

Nedster657  Thursday, November 22, 2007 2:35 PM
Zhi-Xin Ye  Tuesday, November 27, 2007 12:15 PM
Zhi-Xin Ye  Tuesday, November 27, 2007 12:15 PM

You can use google to search for other answers

Custom Search

More Threads

• Need DataGridView Read/Write Example ComboBox
• DataGridView RightToLeft Property doesnt work?
• Memo Field being cut off
• Protecting the appearance of an application form from changing
• How to Databind Control
• Datagrid Columns Changing Width or Added on Re-Load
• AutoGenerateColumns 'false' doesn't always work
• Dynamic Drill-Down DataGrid
• The DataGridViewAutoFilterTextBoxColumn
• ScrollBar disappears on Column sort