This documentation is archived and is not being maintained.

How to: Restrict a Data Column to Contain Unique Values 

You set a DataColumn to contain unique values by adding a unique constraint to a data table. Unique constraints are also called keys. Marking a column as a Primary Key in the Dataset designer will create a Unique Constraint. For more information, see How to: Set a Data Column as the Primary Key.

To constrain a column to contain unique values

  1. Open your dataset in the Dataset Designer.

  2. Right-click the column you want to constrain to unique values. Point to Add, and then click Key.

  3. Verify that the correct column is selected in the Unique Constraint dialog box.

  4. Replace the default name of the constraint with a more meaningful name, if desired. For more information, see Unique Constraint Dialog Box.

See Also