System.Data Namespace DataRelationCollection Class
Returns the specified DataRelation from the collection.
1. Returns the DataRelation at the specified index in the collection.
2. Returns the DataRelation from the collection with the specified name.
The following example uses the Item property to print the names of all DataRelation objects in the collection, each specified by index.
NOTE: This example shows how to use one of the overloaded versions of the Item property ( DataRelationCollection indexer ). For other examples that may be available, see the individual overload topics.
private void PrintRelationNamesByIndex ( DataSet ds ) {
// get the DataRelationCollection from a DataSet.
DataRelationCollection relations = ds.Relations;
// print each relation's name using the index.
for ( int i = 0; i < relations.Count; i++ ) {
Response.Write ( relations [ ] );
}
}
Private Sub PrintRelationNamesByIndex ( Dim ds As DataSet )
' get the DataRelationCollection from a a DataSet.
Dim relations As DataRelationCollection = ds.Relations
' print each relation's name using the index.
For i = 0 To relations.Count -1
Response.Write ( relations ( i ) )
Next
End Sub |
|
C# |
VB |
DataRelationCollection Members