如何检查数据表行中的重复值? [英] How to check duplicate value in data table's rows?

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

问题描述

在数据表中三行 value 在下面给出



< pre lang =C#> 1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30



在上面的值是在这三行。现在我想检查此表中是否出现任何重复值显示验证消息。我已经验证在代码表格下面没有出现空值

 如果(ds.Tables [s] .Rows [ 0 ] [i] .ToString()。Trim()==  
{
dt.Rows.Add();
dt.Rows [mn] [ 0 ] = 标签号应该是强制性的 + ds.Tables [s] .TableName;
}



显示强制性消息。



我尝试过:



i现在会尝试检查重复值信息。

解决方案

嗨Raja



检查以下找到重复值的链接



c# - 从数据表中删除重复条目的最佳方法 - Stack Overflow [ ^ ]

In data table In three rows value given below


1  2  3  4  5  6  7  8  9  10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30


in above values are in this three rows.now i want check if any duplicate value occur in this table show the validation message. already i validate not occur empty value in table use below code

if (ds.Tables[s].Rows[0][i].ToString().Trim() == "")
{
dt.Rows.Add();
dt.Rows[mn][0] = "Tag Number Should Be Mandatory" +ds.Tables[s].TableName; 
}


To show the mandatory message.

What I have tried:

i will now tried check duplicate value message.

解决方案

Hi Raja

Check the following link that finds duplicate values

c# - Best way to remove duplicate entries from a data table - Stack Overflow[^]


这篇关于如何检查数据表行中的重复值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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