Page 1 of 1

HElp with deletion in master detail

Posted: Wed 12 Jun 2019 16:45
by brace
Hi, as a continuation of this topic viewtopic.php?t=27242

i tried to implement a sample in which master detail relationship is done with MasteSource.

when i delete a master record anyway i do not see that the deletion of the details is done correctly.

i will send the sample to support.

i hope you can reply since i am stuck.

THanks.

Re: HElp with deletion in master detail

Posted: Thu 13 Jun 2019 14:11
by Stellar
When creating the "FK_Detailtbl_Mastertbl" foreign key constraint, add the DELETE CASCADE option. Cascade deletion will help retain the link integrity of your database.
For example, here's a foreign key constraint creation script:

Code: Select all

ALTER TABLE [dbo].[Detailtbl]  WITH CHECK ADD  CONSTRAINT [FK_Detailtbl_Mastertbl] FOREIGN KEY([ID_MASTER])
REFERENCES [dbo].[Mastertbl] ([ID_MASTER]) ON DELETE CASCADE

Re: HElp with deletion in master detail

Posted: Fri 14 Jun 2019 08:08
by brace
Thanks for the reply.
So you mean that there is no way to obtain deletiong thgouh "cached updates" withotu using the cascade delete option?

I thought that teh dataset could handle this.

Thanks.

Re: HElp with deletion in master detail

Posted: Wed 19 Jun 2019 15:38
by Stellar
The logic in your sample differs from the logic in the sample described in the viewtopic.php?t=27242 topic. When you delete records from the master dataset. you have to manually delete records from the detail dataset as well. SDAC doesn't automatically delete records from the detail dataset.