[Lazarus] Another Master-detail problem
Koenraad Lelong
lazarus1 at de-brouwerij.be
Fri Apr 27 11:02:56 CEST 2012
Hi,
I think I am doing something fundamentally wrong. Every time I try to do
something with master-detail tables, I get stuck on errors I don't
understand :-( .
I want to add a record in the detail-table, and modify a field in the
master-table. When one of those two goes wrong, I need to revert.
So I made this :
qryDetail.Open;
qryDetail.Append;
qryDetailPRICE.Value:=Price;
qryDetailCALIBDATE.Value:=CalibDate;
... other fields of detail are filled
qryMaster.Edit;
qryMasterLASTCALIB.Value:=CalibDate;
try
qryDetail.Post;
qryDetail.ApplyUpdates;
qryToestel.Post;
qryToestel.ApplyUpdates;
traMasterDetail.Commit;
except
qryDetail.CancelUpdates;
qryMaster.CancelUpdates;
traMasterDetail.Rollback;
end;
When I remove the master-operations, the detail insert works.
My first try did not have the post-statements. The master-update did
work, but nothing got inserted in the detail-table.
When I added the post-statements, I got an error : qryDetail is not in
insert or edit mode.
What am I doing wrong ?
Thanks for any clarification,
Koenraad Lelong.
More information about the Lazarus
mailing list