System.Data Namespace ConstraintCollection Class
Returns the Constraint from the collection at the specified index.
Constraint variable = ConstraintCollection.Item [ index ];
... or ...
Constraint variable = ConstraintCollection [ index ];
dim variable as Constraint = ConstraintCollection.Item ( index )
... or ...
dim variable as Constraint = ConstraintCollection ( index )
variable : Constraint = ConstraintCollection.Item ( index );
... or ...
variable : Constraint = ConstraintCollection ( index ); |
|
C# |
VB |
JScript |
- index
- The index of the constraint to return.
The Constraint at the specified index.
Exception Type |
Condition |
IndexOutOfRangeException |
Occurs when the index value is greater than the number of items in the collection. |
Use the Contains method to test for the existence of a specific constraint.
The following example gets each Constraint from the ConstraintCollection.
private void GetConstraint ( DataTable myTable ) {
for ( int i = 0; i < myTable.Constraints.Count; i++ ) {
Response.Write ( myTable.Constraints [ ].ConstraintName );
Response.Write ( myTable.Constraints [ ].GetType ( ) );
}
}
Private Sub GetConstraint ( myTable As DataTable )
Dim i As Integer
For i = 0 To myTable.Constraints.Count - 1
Response.Write ( myTable.Constraints ( i ).ConstraintName )
Response.Write ( myTable.Constraints ( i ).GetType ( ) )
Next i
End Sub |
|
C# |
VB |
ConstraintCollection Members ConstraintCollection.Item Overload List