How to: Restrict a Data Column to Contain Unique Values
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

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

© 2016 Microsoft