Constraint.ConstraintName Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

The name of a constraint in the ConstraintCollection.

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

Public Overridable Property ConstraintName As String

Property Value

Type: System.String

The name of the Constraint.

Exception Condition
ArgumentException

The Constraint name is a null value or empty string.

DuplicateNameException

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 Sub PrintConstraintNames(myTable As DataTable)
    Dim cs As Constraint
    For Each cs In  myTable.Constraints
        Console.WriteLine(cs.ConstraintName)
    Next cs
End Sub

.NET Framework
Available since 1.1
Return to top
Show: