Board index » delphi » Master/Detail using TQuery & Cached Updates

Master/Detail using TQuery & Cached Updates

Quote
>>Can anyone please give me an example of HOW to implement a
>>master/details relationship using linked TQuery's and Cached Updates.

In addition to what Phil said,  you'll need to take care that when a detail has
been edited, you prevent the user from navigating to another master before
the detail updates have been applied.

If the detail updates are not applied before another master is selected, then the
details updates will be lost.

I usualy disable the master tables navigation controls from the OnDataChange event
for the Detail.    

MasterControl.Enabled := not ( tabDetail.HasUpdatesPending or (tabDetail.state in [dsEdit,dsInsert])

You'll also want to take care that Master updates are applied before detail updates
And that Master _deletions are applied _after detail updates....

===
Bill

 

Re:Master/Detail using TQuery & Cached Updates


Can anyone please give me an example of HOW to implement a
master/details relationship using linked TQuery's and Cached Updates.

This would be very, very appreciated.

Thanks in advance.

Andy.

Re:Master/Detail using TQuery & Cached Updates


Start by looking in the on-line help for a topic called "Applying
updates for master/detail tables." To get there, look in the index for
cached updates and the subtopic called "applying." There's an example
there using queries.

But that doesn't tell the whole story. Assuming you will add, delete
and modify, you will also have to use TUpdateSQL components (one for
each query) and manipulate the updating in the OnUpdateRecord events
of the queries.

But start with the example in help and then come back with more
specific questions. You'll probably have a few and it will seem a bit
daunting at first. Once you've got it, though, it works pretty well.

Good luck.

Phil Cain

Quote
Andrew Norman <andrew.nor...@{*word*269}.net> wrote:
>Can anyone please give me an example of HOW to implement a
>master/details relationship using linked TQuery's and Cached Updates.

>This would be very, very appreciated.

>Thanks in advance.

>Andy.

Other Threads