See Also

ParentDataRelation Members  | Devart.Common Namespace

 

Language

Visual Basic

C#

Show All

See AlsoRequirementsLanguagesDevart.DataSend comments on this topic.

ParentDataRelation Class

Establishes query-based master-detail relation.

For a list of all members of this type, see ParentDataRelation members.

Inheritance Hierarchy

System.Object
   Devart.Common.ParentDataRelation

Syntax

[Visual Basic]
Public Class ParentDataRelation
[C#]
public class ParentDataRelation

Remarks

The ParentDataRelation class is designed to establish a master-detail relationship where details data is not cached on the client. Every time the current position in the master table is changed, the client DbDataTable requests the appropriate portion of data from the server.

Use property ParentTable to specify master DbDataTable, and the properties ParentColumnNames and ChildColumnNames to describe the relationiship.

Note that this feature can be used only for two instances of DbDataTable class that have same Owner. In other words, the DbDataTable objects must reside on the same forms.

Example

The following example shows how to render related data in two grids.

[C#] 

MySqlConnection connection = new MySqlConnection("User Id=root;Host=localhost;Database=Test"); 
connection.Open(); 
MySqlDataTable deptTable = new MySqlDataTable("SELECT * FROM dept", connection); 
MySqlDataTable empTable = new MySqlDataTable("SELECT * FROM emp", connection); 
empTable.ParentRelation.ParentTable = deptTable; 
empTable.ParentRelation.ParentColumnNames = new string[] { "deptno" }; 
empTable.ParentRelation.ChildColumnNames = new string[] { "deptno" }; 
deptTable.Owner = this; 
empTable.Owner = this; 
deptTable.Open(); 
empTable.Open(); 
deptDataGrid.DataSource = deptTable; 
empDataGrid.DataSource = empTable;

[Visual Basic] 

Dim connection As New MySqlConnection("User Id=root;Host=localhost;Database=Test")
connection.Open()
Dim deptTable As New MySqlDataTable("SELECT * FROM dept", connection)
Dim empTable As New MySqlDataTable("SELECT * FROM emp", connection)
empTable.ParentRelation.ParentTable = deptTable
empTable.ParentRelation.ParentColumnNames = New String() {"deptno"}
empTable.ParentRelation.ChildColumnNames = New String() {"deptno"}
deptTable.Owner = Me
empTable.Owner = Me
deptTable.Open()
empTable.Open()
deptDataGrid.DataSource = deptTable
empDataGrid.DataSource = empTable

 

See Also

ParentDataRelation Members  | Devart.Common Namespace

 

 


© 2002 - 2008 Devart. All Rights Reserved.