How to delete all duplicate entries from the datatable using linq

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

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.

Please check this.

I need to remove including the duplicate entry Pls help

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()


1 Like

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