Hi,
We have just migrated our system from Delphi 4 to Delphi 7 changing all TTable components to TOraTable.
Suppose that I have the fields MyKey and MyDesc into MasterTable and the fields MyKey, MyDetailKey and MyDetailDesc into DetailTable.
First I insert into MasterTable and after I insert into DetailTable, when I execute MasterTable.Post, detailTable.Refresh happen and all detailtable data loses;
One example will be more clean:
DataSource: DataSet = MasterTable
MasterTable: CachedUpdates = True; KeyFields = MyKey
DataSourceDetail: Dataset = DetailTable;
DetailTable: CachedUpdates = True; MasterSource = DataSource; MasterFields = MyKey; DetailFields = MyKey
MasterTable.Insert;
MasterTableMyKey.Value := 1;
MasterTableMyDesc.Value := 'Bla bla bla';
DetailTable.Insert
DetailTableMyKey := 1;
DetailTableMyDetailKey := 1;
DetailTableMyDetailDesc := 'a';
DetailTable.Post;
DetailTable.Insert
DetailTableMyKey := 1;
DetailTableMyDetailKey := 2;
DetailTableMyDetailDesc := 'b';
DetailTable.Post;
MasterTable.Post; //at this moment happen the refresh into DetailTable - Oh god, I lost everything that I wrote
What am I doing Wrong ????
Master/details problems when inserting
-
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53
-
- Posts: 2
- Joined: Tue 14 Feb 2006 15:53
What am I going to do with the legacy code ???
It's impossible to migrate everything.
Wouldn't It be more easy the refresh on detailTable to be optional ???
I just don't want that the refresh on Details happen after MasterTable.Post.
Was not TOraTable made to be compatible with TTable ???
Now I've got a terrible headache.
It's impossible to migrate everything.
Wouldn't It be more easy the refresh on detailTable to be optional ???
I just don't want that the refresh on Details happen after MasterTable.Post.
Was not TOraTable made to be compatible with TTable ???
Now I've got a terrible headache.
-
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53