asp.net.ph

ConstraintCollection.Remove Method ( Constraint )

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

Parameters

constraint
The Constraint to remove.

Exceptions


Exception Type Condition
ArgumentNullException Occurs when the constraint argument is a null reference.
ArgumentException Occurs when the constraint does not belong to the collection.

Remarks

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.

Example


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 );
      }
 }
  C# VB

See Also

ConstraintCollection Members   ConstraintCollection.Remove Overload List   CanRemove   Contains   IndexOf Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph