Skip to content Skip to sidebar Skip to footer

Synchronize Data In Two Database Table Upon Deletion

This is my school project. I am in chrage of eForum portion. I tried to delete a user and all the threads and replies by the deleted user will also be deleted. public boolean d

Solution 1:

This seems to be a perfect case for setting up your relationships using Cascade Delete ( http://support.microsoft.com/kb/304466 )

Cascading Updates and Deletes

For relationships in which referential integrity is enforced, you can specify whether you want Microsoft Access to automatically cascade update or cascade delete related records. If you set these options, delete and update operations that would normally be prevented by referential integrity rules are allowed. When you delete records or change primary key values in a primary table, Microsoft Access makes the necessary changes to related tables to preserve referential integrity.

Note however, that Cascade Delete should be used with great care. These post refer to SQL Server, but the ideas apply to any database:

For the most part, I do not delete records first-off, I time-stamp them deleted for deletion at a later date, it is remarkable how often people change their minds.

cascade delete

Post a Comment for "Synchronize Data In Two Database Table Upon Deletion"