I can’t figure out how to compare data in two columns of numbers and remove the row if columns match. please help.
you can use the below code
dt.AsEnumerable().Where(Function(x) Not x("Col1").ToString.Equals(x("Col2").ToString)).CopyToDatatable
Hey check this out
dtoutput=if(dtinput.AsEnumerable().Where(Function(row) Not row(columnname).ToString.Equals(row(column2).ToString)).any(),dtinput.AsEnumerable().Where(Function(row) Not row(columnname).ToString.Equals(row(columnname).ToString)).CopyToDatatable,dtinput.clone)
In this case if i have used a if condition to check if any row will be returned if nothing is returned then we will clone the input table to output or else rows will be stored in output table
I hvae written a if condition for not getting any exception while using linq
Thanks and regards
Sreejith S S