26.1 Comments/Troubleshooting

Constraint objects are contained in a ConstraintCollection. Every DataTable exposes a ConstraintCollection through its Constraints property, which can contain UniqueKeyConstraint and ForeignKeyConstraint objects.

Both UniqueKeyConstraint and ForeignKeyConstraint classes can be created manually. In addition, a UniqueKeyConstraint may be created automatically when filling a DataSet with schema information, and both a ForeignKeyConstraint and a UniqueKeyConstraint may be generated when a DataRelation is defined and added to a table. For more information, refer to Chapter 10.

    Part I: ADO.NET Tutorial
    Part II: ADO.NET Core Classes
    Part III: API Quick Reference