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;
}

猜你喜欢

转载自www.cnblogs.com/clj0102/p/9399335.html