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.

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to