DataSnap Master/Detail Relationship - Post raises exception with message "No corresponding master record found"

StackOverflow https://stackoverflow.com/questions/13668783

  •  04-12-2021
  •  | 
  •  

Question

A duplicate of this question, but since the answer there wasn't accepted I thought maybe there's a workaround. I have two TSQLTable components on my datasnap server which are in a master/detail relationship, and one TDataSetProvider linked to the master table. On my client application, there are two TClientDataSet components, of which one is nested in the other naturally. When I try to post a new record to the detail dataset, even before calling ApplyUpdates(), the mentioned exception is raised. Is this really a bug in XE2? How to work around it?

Here's the diagram SSMS generated for the tables: enter image description here

Was it helpful?

Solution

I assume the master detail relation is by CenterID -> ID. This does not work as expected.

The Midas internals require to use the same field name in both datasets to establish a master detail relationship. Giving your layout it tries to establish a relation using the ID field in both tables.

To resolve this rename the ID field in Centers to CenterID.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top