To be able to write changes back to the datasource, the data adapter object that populates your dataset should have commands set for updating, deleting etc. Fortunately, there is a class called SqlCommandBuilder that generates these commands from our Select command. All we have to do is instantiate this class passing it in the data adapter that we use.
Enclosed is a complete sample: simpledata4.zip
// Command builder will generate the command required to update the // datasource from your select statement SqlCommandBuilder commandBuilder = new SqlCommandBuilder(this.dataAdapter);
After this is done whenever you wish to write changes back to the data source simply call Update on the data adapter as shown below.
if(this.dataSet != null && this.dataSet.HasChanges()) this.dataAdapter.Update(this.dataSet, ''Customers'');