Поделиться через


Relations Collection Editor

Allows you to create, edit, and delete the Relations property of an untyped dataset, which contains a collection of DataRelation objects.

Note

You can use this dialog box to create DataRelation objects only in an untyped dataset. For typed datasets, you create tables and columns using the Dataset Designer. For more information, see How to: Create DataRelations with the Dataset Designer.

DataRelation objects:

  • Provide a link between two tables so that you can find related child records for a particular parent record and vice versa.

  • Give you the option to implement referential integrity between parent and child tables by creating a foreign key constraint. The constraint can prevent a parent record from being deleted if related child records exist, or it can cascade a change (such as a delete) from a parent record to child records.

For more information about DataRelation objects, see Introduction to DataRelation Objects.

To display the editor, select the untyped dataset in the form or component, and then in the Properties window, click the button in the Relations property.

  • Add
    Creates a new DataRelation object in the collection. When you click this button, the editor displays the Relation dialog box, where you can specify properties of the DataRelation object, such as the parent and child tables and the keys that relates the tables.

  • Edit
    Displays the Relation dialog box for the selected relation, allowing you to modify it.

  • Remove
    Deletes the selected relation object. Removing a relation does not also remove any foreign key constraints defined with the relation.

    Note

    You cannot undo this action.

See Also

Reference

DataRelation

Concepts

Introduction to DataRelation Objects

What's New in Data Application Development

Binding Windows Forms Controls to Data in Visual Studio

Preparing Your Application to Receive Data

Fetching Data into Your Application

Binding Controls to Data in Visual Studio

Editing Data in Your Application

Validating Data

Saving Data

Other Resources

Data Walkthroughs

Overview of Data Applications in Visual Studio

Connecting to Data in Visual Studio