How to post a record of details in an Fdquery with the parent record in insert mode?

Asked

Viewed 311 times

0

I’m using two FDQuery with master-detail relationship and found a problem: using property CachedUpdates and relating both FDQuery à um FDSchemaAdapter. Call "Insert / Append" in the Mestre and then (with the record Mestre in dsinsert) is called an "Insert" and then a "Post" in the detail record, the following error occurs:

[Firedac] [Dats] -16. Can not process - no Parent Row. Constraint [Foreignkeyconstraint].

I know this is because in the order "Post", the child record is being entered without a parent record having been posted yet, but in the foreign key database is "Deferred".

So how do I get the FireDac ignore only this restriction without disabling the property DetailCascade and maintain cached cascading "delete/update" functionality?

I’ve tried to use FDSchemaAdapter.DatSManager.EnforceConstraints, but the result is similar to disabling the property DetailCascade of FDquery.

Note: I’m using Delphi XE5.

1 answer

0

Unfortunately, in Delphi XE5, using the DetailCascade is not possible through the native properties of the component. Only from the Berlin version or higher by deselecting the property Detailservercascade. The not pleasant alternative in a scenario of many levels is not to use DetailCascade and do the operations manually.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.