Master / Detail Behavior
I am using Delphi 7 + Zeos + MySQL and I am having a problem when trying to publish a master table, datasets will be posted first, which will throw a referential integrity exception on the database. The couse data tables require the ID Master Table.
Can this behavior be reverted? Can I save the main table in front of the details?
+1
a source to share
1 answer
I think this is just the way TDataSet
. If you have any unpublished detailed notes, master. Post
forces them Post
, if I remember correctly.
So, I assume you have something like:
tblMaster.Insert;
tblMaster.FieldByName('foo').Value := 'foo';
tblDetail.Insert;
tblDetail.FieldByName('bar').Value := 'bar';
tblMaster.Post; // error!
tblDetail.Post;
You should be able to work around this by running the wizard first:
tblMaster.Insert;
tblMaster.FieldByName('foo').Value := 'foo';
tblMaster.Post;
tblDetail.Insert;
tblDetail.FieldByName('bar').Value := 'bar';
tblDetail.Post;
+1
a source to share