Page 1 of 1

Deleting records in a master detail relation

Posted: Mon 14 Jul 2008 08:12
by Cogito
Hi,

if I delete a record in a master table, the detail records are not automatically deleted, because a foreign key restriction. Is it possible to implement here a cascaded delete?

Posted: Tue 15 Jul 2008 06:11
by Antaeus
There are two ways to implement this. The first way is to define the foreign key in the table with the ON DELETE CASCADE option. The second one is to delete correspondent records in the detail table in the BeforeDelete event handler of the master dataset.