Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you make a master-details relationship between the two datasets in your application, ADO can handle it automatically. That means, once you insert a new record into master dataset (orders), you can insert new records in your details dataset (order_items) without the need to specify order_id, because order_id for the current record in master dataset will be automatically retrieved, and inserted in the newly inserted records of details dataset.</p> <p>To make a master/details relationship between your datasets, if you are using AdoTable for detail dataset, you can set its MasterSource to a datasource connected to your master dataset, and define relatinship between the two datasets using MasterFields property. If you are using AdoDataset or AdoQuery, you should set DataSource property in detail dataset to a datasource connected to your master dataset. Then you have to add a WHERE clause in your detail dataset's SQL statement using a SQL paramater with the same name as your key field in the master dataset. In your case it would be something like this:</p> <pre><code>SELECT * FROM t_orderitems WHERE OrderID = :OrderID </code></pre> <p>Now you can set your relationship in MasterFields property of your detail dataset.</p> <p>Since your orders can have multiple items, you can set LockType to ltBatchOptimistic in the detail dataset (order_items), so that once you insert a new item, it is not sent to database immediately. Using ltBatchOptimistic means your changes will be saved in client memory temporally until you call UpdateBatch method. UpdateBatch sends all the changes to the database. </p> <p>If you want to cancel the order, you have to call CancelBatch method to cancel modifications done on detail dataset, and delete the created order record in master dataset manually.</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.
 

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