dotConnect for PostgreSQL Documentation
Devart.Common Namespace / DbDataSet Class
Members Example

In This Topic
    DbDataSet Class
    In This Topic
    Represents an in-memory cache of data with connected model support.
    Syntax
    Remarks

    Base class for provider-specific DataSet components.

    Note: This class is not available in .NET Standard 1.3 compatible assembly. It is available only in the assembly for full .NET Framework and .NET Standard 2.0 compatible assemblies.

    Example
    This sample shows how to use DbDataSet. The routine accepts DbDataSet-compatible object and connection string. After Devart.Data.PostgreSql.PgSqlDataTables were created and populated, they were added to DataTableCollection of DbDataSet, and DataRelation was created to link tables.
    pubic void FillDataSet(DbDataSet dataSet, string connStr) {
            // retrieving data from DEPT table
            PgSqlDataTable dept = new PgSqlDataTable("select * from dept", connStr);
            dept.FetchAll = true;
            dept.Active = true;
          
            // retrieving data from EMP table
            PgSqlDataTable emp = new PgSqlDataTable("select * from emp", connStr);
            emp.FetchAll = true;
            emp.Active = true;
    
            // adding data tables to PgSqlDataSet
            dataSet.Tables.Add(dept);
            dataSet.Tables.Add(emp);
    
            // linking tables to allow navigation from parent table rows
            // to corresponding child table rows
            DataColumn parentColumn = dataSet.Tables["DEPT"].Columns["DEPTNO"];
            DataColumn childColumn = dataSet.Tables["EMP"].Columns["DEPTNO"];
            DataRelation relation =        new System.Data.DataRelation("DeptsEmps",
                    parentColumn, childColumn);
            dataSet.Relations.Add(relation);
    }
    Public Sub FillDataSet(ByRef dataSet As DbDataSet, ByVal connStr As String)
            ' retrieving data from DEPT table
            Dim dept As New PgSqlDataTable("select * from dept", connStr)
            dept.FetchAll = True
            dept.Active = True
    
            ' retrieving data from EMP table
            Dim emp As New PgSqlDataTable("select * from emp", connStr)
            emp.FetchAll = True
            emp.Active = True
    
            ' adding data tables to PgSqlDataSet
            dataSet.Tables.Add(dept)
            dataSet.Tables.Add(emp)
    
            ' linking tables to allow navigation from parent table rows
            ' to corresponding child table rows
            Dim parentColumn As DataColumn = dataSet.Tables("DEPT").Columns("DEPTNO")
            Dim childColumn As DataColumn = dataSet.Tables("EMP").Columns("DEPTNO")
            Dim relation As New System.Data.DataRelation("DeptsEmps", parentColumn, childColumn)
            dataSet.Relations.Add(relation)
    End Sub
    Inheritance Hierarchy

    System.Object
       System.ComponentModel.MarshalByValueComponent
          System.Data.DataSet
             Devart.Common.DbDataSet
                Devart.Data.PostgreSql.PgSqlDataSet

    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