且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查数据表行中的重复值?

更新时间:2023-01-12 21:41:38

嗨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[^]