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
Open your dataset in the Dataset Designer.
Right-click the column you want to constrain to unique values. Point to Add, and then click Key.
Verify that the correct column is selected in the Unique Constraint dialog box.
Replace the default name of the constraint with a more meaningful name, if desired. For more information, see Unique Constraint Dialog Box.
See Also
Tasks
How to: Set a Data Column as the Primary Key
Walkthrough: Displaying Data on a Form in a Windows Application
How to: Connect to Data in a Database
How to: Set the Data Type of a DataColumn
How to: Change the Caption of a DataColumn
How to: Add Columns to a DataTable
How to: Create an Autonumber DataColumn