Understanding Constraints

The DataSet allows you to specify special rules that the data held inside the DataSet.Tables collection must follow. The Constraint base class specifies the rules that the data within a DataTable must follow in order to maintain database integrity. Two descendents from the Constraint class represent specific restrictions that the data must follow. The UniqueConstraint specifies that a particular value for a DataColumn must be unique in the table.

The ForeignKeyConstraint is used to enforce specifc behavior when altering or deleting the primary key column for a table. Because the ForeignKeyConstraint is intended for use in modeling parent-child relationships across tables, it is discussed in more detail in the “Enforcing ...

Get Microsoft® .NET Compact Framework Kick Start 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.