Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'll explain the complete scenario using <strong>AdventureWorks</strong> database for <strong>SQL Server 2008 R2</strong>. I'll also assume that you've already placed the <code>TSQLConnection</code> component and properly set its parameters to established connection with your database. For this example, I'll also assume the name for it to be <strong>Conn1</strong>.</p> <p>On a form, place 2 <code>TSQLTable</code> (named <strong>tableA</strong> and <strong>tableB</strong>), 2 <code>TDataSetProvider</code> (named <strong>dspA</strong> and <strong>dspB</strong>), 2 <code>TClientDataSet</code> (named <strong>cdsA</strong> and <strong>cdsB</strong>), 2 <code>TDataSource</code> (named <strong>dsA</strong> and <strong>dsB</strong>) and 2 <code>TDBGrid</code> (named <strong>gridA</strong> and <strong>gridB</strong>) components.</p> <p>Set properties as follows:</p> <pre><code>tableA.SQLConnection = Conn1 tableA.SchemaName = Sales tableA.TableName = Customer tableA.Active = True dspA.DataSet = tableA cdsA.ProviderName = dspA cdsA.Active = True dsA.DataSet = cdsA gridA.DataSource = dsA tableB.SQLConnection = Conn1 tableB.SchemaName = Sales tableB.TableName = SalesOrderHeader tableB.Active = True dspB.DataSet = tableB cdsB.ProviderName = dspB cdsB.MasterSource = cdsA cdsB.MasterFields = CustomerID cdsB.Active = True dsB.DataSet = cdsB gridB.DataSource = dsB </code></pre> <p>In <strong>gridA</strong> you should see all <strong>Customers</strong>, and in <strong>gridB</strong> you should see only <strong>Orders</strong> related to curently selected customer.</p> <p>This is the basic example of establishing master/detail relationship between two TClientDataSet components in Delphi. However, there are other ways to do this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload