Example of using the adoquery Master/Slave table in Delphi)

Source: Internet
Author: User

Create a master table in SQL Server's northwide

Create Table sell_h (sell_id char (10), cust_name char (10) primary key (sell_id ))

Go

Create Table sell_h (sell_id char (10), inv char (10), AMT float, qty float primary key (sell_id, inv ))

First, pay attention to the following settings

1. Note that the qrydetail settings of the slave table are reported. The batch storage type is open. locktype = batchoptimistic, cursor = keyset, and cursorlocation = cluseclient.

2.

Procedure tform1.formcreate (Sender: tobject );
Begin
Qrymain. close;
Qrydetail. close;
Qrymain. SQL. Add ('select * From sell_h ');
Qrydetail. SQL. Add ('select * From sell_ B where sell_id =: sell_id ');
Qrymain. open;
Qrydetail. open;
End;

3.

Procedure tform1.qrymainafterscroll (Dataset: tdataset );
Begin
Qrydetail. close;
Qrydetail. Parameters. parambyname ('your _ id'). Value: = qrymain. fieldbyname ('your _ id'). value;
Qrydetail. open;

End;

The above are the main settings .. pay attention to the storage problem of Master/Slave tables:

Do not use batch processing to store the master table. Remove ltbatchoptimistic.
The schedule is processed in batches.
You can save the table list before saving the table.

 

From: http://blog.csdn.net/Kandy_Zheng/archive/2007/06/05/1639184.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.