Null value is not considering in dt.select not equal filter

Hi,

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,

2 Likes