如何删除.NET从数据表中的约束? [英] How to remove constraints from datatable in .NET?

查看:128
本文介绍了如何删除.NET从数据表中的约束?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能设置任何限制我的数据表,如果我合并两个数据表 dt1.Merge(DT2); 这表明这样的错误未能启用限制。一个或多个行包含违反非空,唯一,或外键约束。默认情况下我认为在可视化工具它显示的限制数为2。如何从数据表中删除约束和解决这个错误?

I cannot set any constraints in my datatable if i merge two datatables dt1.Merge(dt2); It shows error like this Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. By default i view in visualizer it shows constraints count as 2. How to remove constraints from datatable and solve this error?

推荐答案

从数据表,您可以使用删除约束

To remove constraints from a DataTable you can use:

myDataTable.Constraints.Clear

这篇关于如何删除.NET从数据表中的约束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆