Share via


How to: Enable and Disable Hierarchical Update

Hierarchical update is the process of updating modified data in related data tables in a typed dataset by using the new TableAdapterManager. The TableAdapterManager provides the ability to save data in a dataset that uses multiple TableAdapters and still maintain referential integrity in the database. (Referential integrity is the term that is used to describe data that complies with the foreign-key constraints defined in the database.) For more information, see Hierarchical Update Overview.

You can enable and disable Hierarchical Update by setting the Hierarchical Update property of a typed dataset to either True or False. When Hierarchical Update is set to True, the typed-dataset class is generated with a TableAdapterManager component that manages the process of saving changed data in the dataset back to the database. That is, a TableAdapterManager class is generated that controls the order of the Insert, Update, and Delete commands that are executed against the database by the individual TableAdapters. The TableAdapterManager uses the foreign-key relationships in the database to control the order of these commands. For more information, see TableAdapterManager Overview.

When Hierarchical Update is set to False, the typed-dataset class is generated without a TableAdapterManager component. In this scenario, when you save changes back to the database, you must use programmatic logic to determine the order in which to call the individual Insert, Update, and Delete commands without violating the constraints in the database.

Note

By default, new typed datasets have their Hierarchical Update property set to True.

  1. Open your dataset in the Dataset Designer and click an empty area on the design surface.

  2. In the Properties window, set the Hierarchical Update property to True.

  3. Save the dataset.

    Code is generated with a TableAdapterManager component that automatically performs hierarchical updates.

  1. Open your dataset in the Dataset Designer and click an empty area on the design surface.

  2. In the Properties window, set the Hierarchical Update property to False.

  3. Save the dataset.

    Code is generated without a TableAdapterManager and does not include the logic required to automatically perform hierarchical updates.

See Also

Tasks

Walkthrough: Saving Data from Related Data Tables (Hierarchical Update)

Concepts

What's New in Data Application Development

Saving Data

Other Resources

Hierarchical Update

DataSets, DataTables, and DataViews (ADO.NET)