Hi,
Please find the reference, DataTable filtering with expressions
But the above reference code is removing the row instead of storing it in another datatable… How do I get the duplicate values using LINQ
Hi,
Please find the reference, DataTable filtering with expressions
But the above reference code is removing the row instead of storing it in another datatable… How do I get the duplicate values using LINQ
ListA=From m In((From p in dt.Select()
where ( From q in dt.Select() where string.join(“,”,q.ItemArray).Equals(string.Join(“,”,p.ItemArray))
Select q).ToArray.Count>1
Select p).ToArray.CopyToDataTable).Select()
Select Convert.ToString(m.Item(“Column Name”)).ToList
or
dt2=(From p in dt.Select()
where ( From q in dt.Select() where string.join(“,”,q.ItemArray).Equals(string.Join(“,”,p.ItemArray))
Select q).ToArray.Count>1
Select p).ToArray.CopyToDataTable
ListA=From p In dt2.Select
Select Convert.ToString(p.Item(“Column Name”)).ToList
Regards,
Mahesh
HI @Sunitha_Bist1,
Duplicate records from the same data table
(From p in dt.Select() where( From q in dt.Select() where string.Join(",",q.ItemArray).Equals(string.Join(",",p.ItemArray)) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()
Try this one
If you want specific Column alone mention the column name
(From p in dt.Select() where( From q in dt.Select() where q("ColumnName").Equals(p("ColumnName")) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()
Regards,
Arivu