Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
- Posts: 24
- Joined: Sat 05 Jul 2008 07:15
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?
- Posts: 2098
- Joined: Tue 14 Feb 2006 10:14
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.