C#: Updating DataSet with data from DataGrid to execute DataAdapter.Update.
Posted on 2007-04-02
I have crated a dataset from one table of an Access database which I'm using to populate a datagrid. I have setup the UpdateCommand and InsertCommand properties of the DataAdapter and have tested the insert functionality by programatically adding a row to the DataSet and executing the DataAdapter.Update method. This worked fine.
The bit I'm a bit confused about (as simple as I'm sure it is) is the logic of how to get updated or new rows from the DataGrid get update to the database. In one of the many articles I just read, of which none explicitly explain this detail, I saw mention of the fact that the DataGrid will automatically update the DataSet? From my brief experience of .NET, this doesn't make sense. I would assume I have to use an event from the datagrid to update the dataset.
Could someone let me know what event I should use, and how I can incorporate the data from the DataGrid into the DataSet. For some reason I just can't find any references on how to do this. Probably just too tired.