I have a excel sheet 1 ,How to remove duplicated rows in excel to write in sheet 2,
by using linq query
Thank you
I have a excel sheet 1 ,How to remove duplicated rows in excel to write in sheet 2,
by using linq query
Thank you
uniqueRows = (From row In dtInput.AsEnumerable()
Select row).Distinct(DataRowComparer.Default).CopyToDataTable()
Tr this:
(From d In dt.AsEnumerable
Group d By k1=d("column name").toString.trim()
Into grp = Group
Where grp.Count = 1
Select grp.First).CopyToDataTable
Regards
dt.AsEnumerable.GroupBy(Function(a) Tuple.Create(a("CName1").ToString,a("Cname2").ToString)).Select(Function(b) b.First).CopyToDataTable
Cheers
Try this
dtUnique = dtInput.AsEnumerable().
GroupBy(Function(row) row("ColumnName").ToString()).
Select(Function(g) g.First()).CopyToDataTable()
Regards,
Hi @ravisinghdas199 ,
Use this Linq Query
(From d In dt.AsEnumerable
Group d By k1=d(“column name”).toString.trim()
Into grp = Group
Where grp.Count = 1
Select grp.First).CopyToDataTable
Regards
Sandy
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.