I need to remove some duplicate raw from a data table and I use the following code:
but I get the exception " A column named ‘Column4’ already belongs to this DataTable"
Someone knows how to fix this?
Is it possible to attach the xml, to check the error. Because I have verified it . It is working well.
Can you try this.without curly braces
Thank you for your answer. I think I can to resolve it using dt=dt.DefaultView.ToTable(True) because I’m working with the entire data table.
The problem now is that I have two equal rows that differ only for one space and robot can’t recognize it.
There is a way to remove all spaces from the entire table?
Thank you again for your support
you should not remove all the empty space, you need to remove at the end only
try like this
((From LineNo In dt.DefaultView.ToTable(True,"Product").Select().ToList() Select (From row In dt.Select Where row("Product").ToString.Trim=LineNo("Product").ToString.Trim Select row).ToList(0)).ToList()).CopyToDatatable()