Cascadind删除和更新 [英] Cascadind delete and update
问题描述
我有以下表结构。
产品Product_Categories Product_Symptoms
.......................... ............ ......................................... ......... ................................................ >
Product_id(pk)Product_Catg_id(fk)Product_Sym_id(fk)
Product_name Product_name Product_name
Product_MRP Category_name症状名称
Product_price
.... .................................................. ................
在我的asp应用程序中如果我删除产品表中的product_name,它也必须在Product_Categories和Product Symptoms中删除。更新同样的事情。
我可以为此要求提供任何示例代码。
谢谢
Hi,
I have following table structure.
Products Product_Categories Product_Symptoms
.......................... ..................................................... ........................................................
Product_id (pk) Product_Catg_id(fk) Product_Sym_id(fk)
Product_name Product_name Product_name
Product_MRP Category_name Symptom_name
Product_price
......................................................................
in my asp application if i delete product_name in product table it has to delete in Product_Categories and Product Symptoms also. Same thing for Update also.
Can i have any sample code for this requirement.
Thanks
推荐答案
最简单的方法是让SQL处理它:使用Cascading Delete。
见这里:http://technet.microsoft.com/en-us/library/ms186973(v=sql.105).aspx [ ^ ]
The easiest way is to let SQL handle it: use Cascading Delete.
See here: http://technet.microsoft.com/en-us/library/ms186973(v=sql.105).aspx[^]
浏览http://www.mssqltips.com/sqlservertip/2743/using-delete-cascade-option-for-foreign-keys/ [ ^ ]。
这篇关于Cascadind删除和更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!