System.Data Namespace ConstraintCollection Class
Removes the specified Constraint from the collection.
[ VB ]
Overloads Public Sub Remove ( _
ByVal constraint As Constraint _
)
[ C# ]
public void Remove (
Constraint constraint
);
[ C++ ]
public: void Remove (
Constraint* constraint
);
[ JScript ]
public function Remove (
constraint : Constraint
);
- constraint
- The Constraint to remove.
Use the Contains method to determine if the collection contains the target Constraint.
Use the CanRemove method to determine if a Constraint can be removed.
The CollectionChanged event occurs if the removal succeeds.
private void RemoveConstraint ( DataTable myTable, Constraint myConstraint ) {
try {
if ( myTable.Constraints.Contains ( myConstraint.ConstraintName ) ) {
if ( myTable.Constraints.CanRemove ( myConstraint ) ) {
myTable.Constraints.Remove ( myConstraint );
}
}
}
catch ( Exception myException ) {
Response.Write ( myException.Message );
}
}
Private Sub RemoveConstraint ( myTable As DataTable, myConstraint As Constraint )
Try
If myTable.Constraints.Contains ( myConstraint.ConstraintName ) Then
If myTable.Constraints.CanRemove ( myConstraint ) Then
myTable.Constraints.Remove ( myConstraint )
End If
End If
Catch myException As Exception
Response.Write ( myException.Message )
End Try
End Sub |
|
C# |
VB |
ConstraintCollection Members ConstraintCollection.Remove Overload List CanRemove Contains IndexOf