ConstraintName Property
Collapse the table of content
Expand the table of content

Constraint.ConstraintName Property


The name of a constraint in the ConstraintCollection.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

public virtual string ConstraintName { get; set; }

Property Value

Type: System.String

The name of the Constraint.

Exception Condition

The Constraint name is a null value or empty string.


The ConstraintCollection already contains a Constraint with the same name (The comparison is not case-sensitive.).

The ConstraintCollection is returned by the Constraints property of the DataTable class.

The following example iterates through the ConstraintCollection of a DataTable and prints each ConstraintName.

private void PrintConstraintNames(DataTable myTable){
   foreach(Constraint cs in myTable.Constraints){

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft