Hi,
I have data table as below:
I am providing condition to compare as below: dt.select(“[ID1] <> [ID2]”)
My expectation: I need to get last 3 rows in output. However, I am getting only last row in output. i.e., if any of the column value is blank, it is considering as equal.
Please suggest
Hi @vigneshnkv
Please try this,
dt.asenumerable.where(function(row) not row("ID1").tostring.trim.equals(row("ID2").tostring.trim)).copytodatatable
Thanks
I think it’s better to use LINQ as @prasath_S shows. However if you want to use DataTable.Select method, the following will work.
dt.Select("[ID1]<>[ID2] OR ([ID1] IS NULL AND NOT([ID2] IS NULL)) OR (NOT([ID1] IS NULL) AND [ID2] IS NULL)")
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.