MSDN Library

Tables Collection Editor

Allows you to add and remove DataTable objects to or from a dataset. This dialog box appears when you are using the Properties window to edit the Tables property of a dataset on a form or component.

Note   You can use the Tables Collection Editor to configure tables only in an untyped dataset. For typed datasets, you modify the dataset's schema. For more information, see Adding Tables to an Existing Dataset.

The editor is divided into two panes. In the left pane you add and remove DataTable objects, and in the right pane you set properties for an individual table, including:

  • TableName property, by which you can refer to the table in code.
  • Adding and removing columns. You do this by editing the table's Columns collection, which displays the Columns Collection Editor.
  • Defining the table's primary key (after creating columns). You can do this by editing a table's PrimaryKey property and choosing the parts of the key from the drop-down list of columns.
  • Adding and removing constraints. A unique constraint guarantees that there are no duplicates in a specific column and allows you to define a primary key. A foreign key constraint allows you to define referential integrity between a parent and child table.

    A table can have multiple constraints, each of which is stored as a Constraint object in the table's Constraints collection. When you edit the table's Constraints property, the Constraints Collection Editor is displayed where you can add and remove individual constraints.

    For more information about adding and configuring tables, see Adding Untyped Datasets to a Form or Component.

Add
Creates a new DataTable object in the collection. By default, the table is named dataTablen, where n is a sequential number. You can rename the table by setting its TableName property in the properties grid.
Remove
Deletes the selected table from the dataset.
Caution   You cannot undo this action.

See Also

DataTable Class | Adding Untyped Datasets to a Form or Component

Show:
© 2016 Microsoft