Gets related rows from another table which are linked by the specified relationship name.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public RowCollection GetRelatedRows( string relationshipName ) |
Visual Basic (Declaration) |
---|
Public Function GetRelatedRows ( _ relationshipName As String _ ) As RowCollection |
Parameters
- relationshipName
- Type: System..::.String
The name of the geodatabase relationship class or the name which defines the relationship between two tables.
Return Value
A RowCollection object which contains a number of Row objects each of which represents a record in the Table.Remarks
To use this method a relationship must already be defined between two tables in a
geodatabase relationship class. Note that this method will not work for in-memory TableRelationship, instead
use the GetRelatedRows(TableRelationship) overload.
Examples
The code below returns the name of the property owners (owners table) for the specified land parcel (parcels feature class)
by passing in the geodatabase relationship class name to the GetRelatedRows method.
CopyC#
//Open Montgomery file geodatabase Geodatabase gdb = new Geodatabase(@"C:\Data\Montgomery.gdb"); //Open the parcels featureclass Table parcels = gdb.OpenTable("parcels"); //Get a single parcel Row parcel = parcels.GetRow(3704); //The parcels table is related to the owners table through the ParcelOwners geodatabase relationship class. foreach (Row owner in parcel.GetRelatedRows("ParcelOwners")) { //Print the names of the owners of this parcel System.Diagnostics.Debug.Print(owner.Values["owner_name"].ToString()); }
CopyVB.NET
'Open Montgomery file geodatabase Dim gdb As Geodatabase = New Geodatabase("C:\Data\Montgomery.gdb") 'Open the parcels featureclass Dim parcels As Table = gdb.OpenTable("parcels") 'Get a single parcel Dim parcel As Row = parcels.GetRow(3704) 'The parcels table is related to the owners table through the ParcelOwners geodatabase relationship class. For Each owner As Row In parcel.GetRelatedRows("ParcelOwners") 'Print the names of the owners of this parcel System.Diagnostics.Debug.Print(owner.Values.Item("owner_name").ToString()) Next