Master – detail

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 1
Joined: Fri 11 May 2007 08:24

Master – detail

Post by blackday » Fri 11 May 2007 08:37


I have a master detail relation.
In master table I have got a field, which have a value (SUM of field in detail table).

In detail table on event After post: I wrote next statemets:
MainTable.FieldByName('nameofthefield').asFloat:= SUM Value; //EX: 12

The problem is next: I am inserting a record in detail table. When I wont to moved into next record, detail table is getting in post state, but I am still in the same record, why do not wont to move in next record? Then I must tu press another demand to move cursor in next record.

Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 11 May 2007 15:39

Can you reproduce this problem with a SDAC demo? You can find SDAC demos in the SDAC_InstDir\Demos directory. SDAC_InstDir is the SDAC installation directory on your computer. If you can not, please send me small a sample to demonstrate this problem at evgeniyD*crlab*com, including script to create and fill tables.
Also supply me the following information:
- exact version of Delphi or C++Builder;
- exact version of SDAC. You can see it in the About sheet of TMSConnection Editor.

Note, the way you chose to implemented summation, may lead to data corruption if someone change data from other tool. Probably it would be better to implement summation inside a trigger, or to use a view insted of the column in your master table.

Post Reply