p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 (http://p2p.wrox.com/forumdisplay.php?f=264)
-   -   Deleting Categories (http://p2p.wrox.com/showthread.php?t=45343)

spardoe July 17th, 2006 09:45 PM

Deleting Categories
 
Hi,
In Chapter 5, when a category is deleted through the website admin page, the related articles for that category are also deleted. I can't seem to find the code that deletes these articles, however. Am I missing something?

Cheers,
Simon


MythicalMe July 18th, 2006 01:24 AM

The articles are automatically deleted through SQL in a process known as cascading delete. When a relationship is set up between two tables an option can be specified to do a cascading update and/or delete. That means that anything that is requested to be done to the parent table is first cascaded to the child table(s). This can be very handy when you have a complicated database structure. Without cascading delete a table can have a child records that are orphaned and inaccessible.


spardoe July 18th, 2006 03:30 AM

Thanks MythicalMe, this helped me a lot and it's working on my website now, too.
I eventually found a reference to this on p.246 saying it is set up in the tables using database diagram. Is this the usual way of setting up cascading deletes? I haven't used them before.

Regards,
Simon


MythicalMe July 18th, 2006 11:20 AM

A stipulated yes. Anytime you can let SQL server take some of the workload your application is going to perform better, however, like most applications, it depends on the specific case. One time that you might not want to use cascading delete is when a child table has two or more parents.


spardoe July 19th, 2006 03:07 AM

Thanks once again MythicalMe, you have been very helpful.




All times are GMT -4. The time now is 12:13 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.