DataSet::GetChanges Method ()

 

Gets a copy of the DataSet that contains all changes made to it since it was loaded or since AcceptChanges was last called.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

public:
DataSet^ GetChanges()

Return Value

Type: System.Data::DataSet^

A copy of the changes from this DataSet that can have actions performed on it and later be merged back in using Merge. If no changed rows are found, the method returns null.

Creates a new DataSet that contains a copy of all rows in the original DataSet that have pending changes. Relationship constraints can cause additional unchanged rows to be added to the new DataSet if the unchanged rows contain primary keys corresponding to foreign keys in the changed rows. The method returns null if there are no rows in the original DataSet that have pending changes.

The following example creates a simple DataSet with one table, two columns, and ten rows. Two values are changed, and one row is added. A subset of the changed data is created using the GetChanges method. After reconciling errors, a new column is added to the subset, changing the schema. When the Merge method is called with the missingSchemaAction set to MissingSchemaAction.Add, the new column is added to the original DataSet object's schema.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: