for (int Row = 0; DeleteRow < RowCount; Row++) { // Check if the row is already deleted if (dt.Rows[DeleteRow].RowState != DataRowState.Deleted && dt.Rows[DeleteRow].RowState != DataRowState.Detached) { // Delete the row this.Delete(dt.Rows[DeleteRow]); // Get an updated row count since this may change // if ImmediateDelete is true, or if deleting a // newly added record (both of these conditions // remove the DataRow from the DataTable RowCount = dt.Rows.Count; } else { // Increment the variable so we go to the next row DeleteRow++; } } // If specified to do so, save the DataSet which deletes // all rows marked as Deleted from the database if (this.ImmediateDelete) { this.SaveDataSet(ds, tableName); }However, inside the Delete(dataRow), this also performs a check on ImmediateDelete property (see below)
if (dr.RowState != DataRowState.Added && this.ImmediateDelete) { // Retrieve the row being deleted into a temporary DataSet // (we're using GetConflictData() to do this) DataSet dsDelete = this.GetConflictData(dr); // Delete the row from the temporary DataSet and save it dsDelete.Tables[TableName].Rows[0].Delete(); mmDataAccessBase dao = this.GetDataAccessObject(); dao.SaveDataSet(dsDelete, TableName, null, false, null); // Remove the row from the original DataSet ds.Tables[TableName].Rows.Remove(dr); } else { // Just mark the row as deleted dr.Delete(); }If the Delete(dataRow) method checks the ImmediateDeledte property and if true, executes the SaveDataset, then the subsequent check back in the DeleteAll() method will never have any data to save? Is this correct?