Constraints
As you're probably aware by now, you can place constraints on tables to ensure that the data in them conforms to certain rules. Among these are unique constraints, primary keys, and foreign keys.
Applying Unique Constraints
As shown in the previous section, you can use the Unique property to enforce uniqueness on a DataColumn by setting the property to True. Conversely, you can remove the constraint simply by setting the Unique property to False. However, unique constraints can also include more than one column so that the combination of columns will be unique. Because setting each of the column's Unique properties to True won't enforce the rule that their combination must be unique, you need some way to group the unique columns together. ...
Get Sams Teach Yourself ADO.NET in 21 Days now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.