DataSet.Relations DataSet.Relations DataSet.Relations DataSet.Relations Property


Ottenere l'insieme di relazioni che collegano le tabelle e consentono la navigazione dalle tabelle padre a quelle figlio.Gets the collection of relations that link tables and allow navigation from parent tables to child tables.

 property System::Data::DataRelationCollection ^ Relations { System::Data::DataRelationCollection ^ get(); };
public System.Data.DataRelationCollection Relations { get; }
member this.Relations : System.Data.DataRelationCollection
Public ReadOnly Property Relations As DataRelationCollection

Valore della proprietà

Classe DataRelationCollection che contiene una raccolta di oggetti DataRelation.A DataRelationCollection that contains a collection of DataRelation objects. Se non esiste alcun oggetto DataRelation viene restituito un insieme vuoto.An empty collection is returned if no DataRelation objects exist.


L'esempio seguente visualizza il nome della colonna di tutte le tabelle figlio tramite la Relations proprietà.The following example prints the column name of all child tables through the Relations property.

Private Sub PrintChildRelationRows()
   ' Declare variable to hold the row values.
   Dim rowValues As String
   Dim dataSet As DataSet

   ' Get the DataSet of a DataGrid that is displaying data 
   ' of at least two tables.
   Dim table As DataTable = CType(DataGrid1.DataSource, DataTable)

   ' Navigate using the Relations.
   Dim relation As DataRelation
   Dim row As DataRow
   Dim column As DataColumn

   ' Print the names of each column in each table.
   For Each relation In dataSet.Relations
      For Each column in relation.ChildTable.Columns
          rowValues &= column.ColumnName & " "

    ' Display results.
   End Sub

Si applica a

Vedi anche