Editare

Partajați prin


Constraint.ConstraintName Property

Definition

The name of a constraint in the ConstraintCollection.

public:
 virtual property System::String ^ ConstraintName { System::String ^ get(); void set(System::String ^ value); };
public virtual string ConstraintName { get; set; }
[System.Data.DataSysDescription("ConstraintNameDescr")]
public virtual string ConstraintName { get; set; }
member this.ConstraintName : string with get, set
[<System.Data.DataSysDescription("ConstraintNameDescr")>]
member this.ConstraintName : string with get, set
Public Overridable Property ConstraintName As String

Property Value

The name of the Constraint.

Attributes

Exceptions

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.).

Examples

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){
      Console.WriteLine(cs.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

Remarks

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

Applies to