NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataSet.Relations

Get the collection of relations that link tables, and allow navigation from parent tables to child tables.

[Visual Basic]
Public ReadOnly Property Relations As RelationsCollection
[C#]
public RelationsCollection Relations {get;}
[C++]
public: __property RelationsCollection* get_Relations();
[JScript]
public function get Relations() : RelationsCollection;

Property Value

A RelationsCollection that contains a collection of DataRelation objects.

Example [Visual Basic]

The following example prints the column name of all child tables through the Relations property.

[Visual Basic]

Private Sub PrintChildRelationRows()
   ' Declare variable to hold the row values.
   Dim strRowVals As String
   Dim myDataSet As DataSet
   ' Get the DataSet of a DataGrid that is displaying data of at least two tables.
   myTable = DataGrid1.DataSource
   ' Navigate using the Relations.
   Dim myRel As DataRelation
   Dim row As DataRow
   Dim col As DataColumn
   ' Print the names of each column in each table through the Relations.
   For Each myRel In myDataSet.Relations
      For Each col in myRel.ChildTable.Columns
          strRowVals &= col.ColumnName & vbcrlf
      Next
    Next
    ' Display results.
    Console.WriteLine(strRowVals)
   End Sub

See Also

DataSet Class | DataSet Members | System.Data Namespace | DataRelation | DataTable | RelationsCollection