Argh, please help
Scenario is a simple master/detail table pair. Both tables defined in my schema with correct relationship and update rules. Components added to my data module and correct master/detail relationship configured between them.
I’m adding a new master record, which gets a temporary PK value of -1.
Then I add a new detail record, which gets a PK of -1 but also a FK “parentid” value of -1, referencing the new master.
All fine at this point.
I call ApplyUpdates on the master table. Cascade updates are set.
Both records are added to the database so the cascade update is working fine.
Both records’ PK values in the database are generated automatically (MSSQL IDENTITY columns).
The problem is that the FK “parentid” column value of the detail record in the database is still -1.
Basically the newly assigned PK of the master hasn’t been propagated down to the FK of the detail.
Now I’ve got this type of hierarchy literally EVERYWHERE in my project and have never had a problem with it, just this particular pair of tables are causing me grief.
I’m clearly missing something stupid somewhere but I’m losing my mind trying to think what.
Any advice on anything else to check?
UPDATE: Ahh think I’ve found it - think I’m applying the detail before the master (update rules wrong). Why do I keep discovering the problem right after I post here?!