110,538
社区成员
发帖
与我相关
我的任务
分享
int count1 = (from p in dt.AsEnumerable() select p).Distinct().Count();
int count2 = (from p in dt.AsEnumerable() select p).Count();
if (count1 < count2)
{
MessageBox.Show("重复");
}
int count = (from p in dt.AsEnumerable() where
p.Field <string>("列1") == "123"
&& p.Field<string>("列2") == "345"
select p).Count();
if(count>0)
{
MessageBox.Show("重复");
}
DataTable DT = new DataTable();
var isRepeat = DT.AsEnumerable().Where((r, next) => r.Field<int>("Id") equals ????).Any();
int count1 = (from p in dt.AsEnumerable() select p.Field<string>("主键列")).Distinct().Count();
int count2 = (from p in dt.AsEnumerable() select p.Field<string>("主键列")).Count();
if (count1 < count2)
{
MessageBox.Show("主键重复");
}