C# DatatTable某一列是否有重复判断

public bool HasRepeatData(DataTable dt,string[] colName)
{
bool flag=false;
DataView myDataView = new DataView(dt);
if (myDataView.ToTable(true, colName).Rows.Count < dt.Rows.Count)
{
flag = true;
}
return flag;
}

posted @ 2018-08-01 08:57  chenlijun0102  阅读(1470)  评论(0编辑  收藏  举报