I\'m writing a Winforms app in C# that enables the user to edit and update database using the datagridview.
The problem is, I can\'t make it to work. The only thing
Without calling bindingSource1.EndEdit
your underlying DataTable doesn't see any change and thus the Update command has nothing to update.
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
bindingSource1.EndEdit();
DataTable dt = (DataTable)bindingSource1.DataSource;
// Just for test.... Try this with or without the EndEdit....
DataTable changedTable = dt.GetChanges();
Console.WriteLine(changedTable.Rows.Count);
int rowsUpdated = da.Update(dt);
Console.WriteLine(rowsUpdated);
}