Dela via


Tables Collection Editor

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

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.

  • 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.

See Also

Other Resources

DataTables (ADO.NET)

Getting Started with Data Access

Connecting to Data in Visual Studio

Preparing Your Application to Receive Data

Fetching Data into Your Application

Displaying Data on Forms in Windows Applications

Editing Data in Your Application

Validating Data

Saving Data