Reputation: 1660
I have a page with GridView
pulling some data from a SQL Server database via Linq-to-SQL.
I made use of the automatically-generated buttons for deleting. However, in order for the delete command to work properly, I need to somehow make sure that one table in relation with those records I want to delete, is also modified (the related record in it is also looked up and deleted).
Whats the easiest way to do this?
Thanks, Ondrej
Upvotes: 0
Views: 210
Reputation: 460208
Define a foreign-key constraint with cascade delete.
Specify what happens if a user tries to delete a row with data that is involved in a foreign key relationship:
Upvotes: 2