dotConnect for SQLite Documentation
Devart.Common Namespace / ParentDataRelation Class
Members Example

In This Topic
    ParentDataRelation Class
    In This Topic
    Establishes query-based master-detail relation.
    Syntax
    'Declaration
     
    Public Class ParentDataRelation 
    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 DbDataTable.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.
    SQLiteConnection connection = new SQLiteConnection(
        "DataSource=mydatabase.db;");
    connection.Open();
    SQLiteDataTable deptTable = new SQLiteDataTable("SELECT * FROM dept", connection);
    SQLiteDataTable empTable = new SQLiteDataTable("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.FetchAll = true;
    empTable.FetchAll = true;
    deptTable.Open();
    empTable.Open();
    deptDataGrid.DataSource = deptTable;
    empDataGrid.DataSource = empTable;
    Dim connection As New SQLiteConnection( _
        "DataSource=mydatabase.db;")
    connection.Open()
    Dim deptTable As New SQLiteDataTable("SELECT * FROM dept", connection)
    Dim empTable As New SQLiteDataTable("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.FetchAll = True
    empTable.FetchAll = True
    deptTable.Open()
    empTable.Open()
    deptDataGrid.DataSource = deptTable
    empDataGrid.DataSource = empTable
    Inheritance Hierarchy

    System.Object
       Devart.Common.ParentDataRelation

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also