DataTable.ChildRelations Property

 

Gets the collection of child relations for this DataTable.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

[<BrowsableAttribute(false)>]
member ChildRelations : DataRelationCollection with get

Property Value

Type: System.Data.DataRelationCollection

A DataRelationCollection that contains the child relations for the table. An empty collection is returned if no DataRelation objects exist.

A DataRelation defines the relationship between two tables. Typically, two tables are linked through a single field that contains the same data. For example, a table which contains address data may have a single field containing codes that represent countries/regions. A second table that contains country/region data will have a single field that contains the code that identifies the country/region, and it is this code which is inserted into the corresponding field in the first table. A DataRelation, then, contains at least four pieces of information: (1) the name of the first table, (2) the column name in the first table, (3) the name of the second table, and (4) the column name in the second table.

The following example uses the ChildRelations property to return each child DataRelation in a DataTable. Each relation is then used as an argument in the GetChildRows method of the DataRow to return an array of rows. The value of each column in the row is then printed.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: