How to delete all duplicate entries from the datatable using linq

For eg
Input:
User Name
Zablotny, Elaine
Benayoun, Michel
Benayoun, Michel
Hurshman, Robin

Output:
User Name
Zablotny, Elaine
Hurshman, Robin

It should remove all the duplicate entries from the datatable using linq Kindly help me guys

No need for linq, you can just use

duplicate occurrence itself it should remove

Hi @Aravinthan ,
You can remove duplicate rows from data table using remove duplicate rows activity ,it will remove all duplicate rows except the first one.
Cheers

Please check this.

I need to remove including the duplicate entry Pls help

1 Like

Hi @Aravinthan,

use below Linq Query.

(From p in dt.Select() where( From q in dt.Select() where q("User Name").Equals(p("User Name")) Select q).ToArray.Count=1 Select p).ToArray.CopyToDataTable()

Regards,
Arivu

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.