Link to home
Start Free TrialLog in
Avatar of Esulin
Esulin

asked on

C#: Updating DataSet with data from DataGrid to execute DataAdapter.Update.

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.
Avatar of Esulin
Esulin

ASKER

I'm in a bit of a hurry so bumping up the points.
Avatar of theGhost_k8
if u just want to refill the grid with new data, just assign ds to grid's datasource after you add it to DB.
obv. you should refill the ds as well before assigning.
ASKER CERTIFIED SOLUTION
Avatar of theGhost_k8
theGhost_k8
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial