Reputation: 643
Im going crazy with this. I did the ff:
A closer look at the datatable after editing, the row states were not updated even if i actually edited the datatable thru the datagridview but the edited DataRow(s) have changes in the item array. Really confusing.. Any ideas? Thanks.
Upvotes: 0
Views: 1581
Reputation: 10681
You need several things to make this work. If you drag the table from the Data Sources view you end up with a few different things on your GUI:
With these in place you can look at the source code to see what hapens beind the scenes. You'll need the EndEdit (as Baldi said before) but you need a little more:
private void UpdateGridView()
{
// validate that data types corresponds to database table column
this.Validate();
// ends edit on the graph table
this.graphBindingSource.EndEdit();
// ends edit on the graph table
this.intervalBindingSource.EndEdit();
// connect to the database - and exceute changes
this.tableAdapterManager.UpdateAll(this.diagramDBDataSet);
}
Hopefully this gets you started. If you want to learn more - you can follow this .NET database slide show with the complementary database tutorial. Good luck!
Upvotes: 1