从数据集中删除值
我有一个包含 3 个表的数据集,它们具有主子关系, 假设数据集就像这个
部门表
deptID departmentname
1 IT
2 CS
3 EC
员工表现
empID Empname DeptID
1 kiran 1
2 manu 2
3 kumar 3
4 ajay 3
在我必须从部门表中删除值 deptID =3
然后所有具有 DeptID ='3' 的员工必须从员工表中删除
我们在数据集中该怎么做,有吗任何内置功能
谢谢
Prince5
i have an dataset with 3 tables in it they have a masterchild relationship,
lets say the dataset is like this
department table
deptID departmentname
1 IT
2 CS
3 EC
employee table
empID Empname DeptID
1 kiran 1
2 manu 2
3 kumar 3
4 ajay 3
now i have to delete value deptID =3 from department table
then all the employee who have DeptID ='3' have to be deleted from Employee table
how do we do in dataset , is there any builtin function
thanks
Prince5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须定义一个ForeignKeyConstraint并将规则设置为级联:
现在,当您删除父级中的记录时,它也会删除子级中的记录。
You have to define a ForeignKeyConstraint and set the rule to cascade:
Now when you delete records in the parent it will delete them in the children as well.
您可以向数据集添加约束并启用级联删除
http://msdn.microsoft.com/en-us/library/st1t2c35.aspx
You can add a constraint to you dataset and enable cascade deleting
http://msdn.microsoft.com/en-us/library/st1t2c35.aspx