Board index » delphi » Problem: Cascading Referential Integrity with Paradox tables

Problem: Cascading Referential Integrity with Paradox tables

I use Delphi 4 PE with Paradox 7 tables created and defined by Database
Desktop 7.
I struggle with two problems/questions.

1. How to: Cascading delete
When I define a referential integrity between two tables with the cascade
option on, the cascade only works with record updates, not with record
deletes.
For example I have a Customer and Order table, linked by CustomerId. When I
modify the CustomerId in Customer, the CustomerId in Order for all related
records are automatically modified too (just what I expect). But when I
delete a record in Customer I get an error 'Master has detail records.
Cannot delete or modify'.

2. How to: Multi level cascading
I want to define multi-level referential integrity between three tables.
For example I have a Customer, Order and Orderline table. The Customer and
Order table are linked by CustomerId, the Order and OrderLine table are
linked by CustomerId, OrderId. When I define the second referential
integrity with the cascade option on, I get an error 'Multi-level cascade is
not supported'.
Is this a shortcoming of the Database Desktop 7?
Are there other tools which will support defining multi-level cascade?

Thanks,
Robert, the Netherlands

 

Re:Problem: Cascading Referential Integrity with Paradox tables


Paradox tables don't support cascade deletes, as far as I know. The
usual method is to write code to delete the records from the linked
tables before deleting the master record. This is often put in the
BeforeDelete event of the master table.

HTH,
Dan

--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control: Consulting, Software,
and the only comprehesive textbook on this subject.
visit us at www.cmdcsystems.com
[Remove the SPAM from my e-mail address]

Other Threads