I have 4 ClientDataSets like this:
Master
---Detail 1
---Detail 2
------SubDetail 2.1 - here there is a FK to Detail 1
The insert order of records on datasets is: Master, Detail 1, Detail 2, SubDetail 2.1.
However, the insert order on database, when I call ApplyUpdates, is Master, Detail 2, SubDetail 2.1, Detail 1.
So I get an error "Foreign key reference target does not exist", because there is a FK on SubDetail 2.1, that point to a record on Detail 1, which isn't inserted on database yet.
Can I change the post order of nested datasets on database? Or is there another way to fix this problem?