>DataSet dsChanged = dsMyDataSet.GetChanges(DataRowState.Modified); >foreach (DataTable Table in dsChanged.Tables) // !!!! Error Here! >{ > >} >>
// Check for changes with the HasChanges method first. if(!dataSet.HasChanges(DataRowState.Modified)) return; // Create temporary DataSet variable and // GetChanges for modified rows only. DataSet tempDataSet = dataSet.GetChanges(DataRowState.Modified); // Check the DataSet for errors. if(tempDataSet.HasErrors) { // Insert code to resolve errors. }Also, if you try to GetChanges after an AcceptChanges, it will return a null reference. Also, the .Added state takes preference to the .Modified state so keep that in mind too. There is a nice little example here (working with a datatable):