ZKX's LAB

datatable查找重复数据 怎么读取DataTable某一列的值?然后用c#代码判断是否有重复数据?linq还是怎么做呢?

2021-04-07知识4

DataTable 根据某列Select 出重复数据,保留不重复的数据 你是要动态判断列吗?select*from table where 列名=值这个行不行?还要根据每列找出不重复的值select distinct 列名 from table

DataTable判断是否有重复数据 1.DatatTable 某个字段是否重复DataTable dtTableDisinit=(DataTable)this.c1TrueDBGrid1.DataSource;DataView dv=new DataView(dtTableDisinit);if(dv.Count。dv.ToTable(true,\"PMD_SingProduct\").Rows.Count){Common.showMessageInfo(\"网格中存在重复的品番。return;}2.数组中去重复的数据和判断一个数组中是否有重复的数据string[]strSing=this.PM_CollectionGoods.Text.ToString().Trim().Split(',');string[]strDis=strSing.Distinct().ToArray();if(strSing.Length。strDis.Length){Common.showMessageInfo(\"数组中存在重复的数据\");return;}

C# 处理DataTable 重复数据 List<;string>;temps=new List();for(int i=0;i;{string s=dt.Rows[i][\"C\"].ToString();if(temps.Contains(s)){dt.Rows.RemoveAt(i);}else {temps.Add(s);}希望对你有帮助

#datatable获取重复数据#datatable查找重复数据

随机阅读

qrcode
访问手机版