Arun Chandran C Arun Chandran C - 8 months ago 49
SQL Question

C# DataTable.Select() - How do I format the filter criteria to include null?

This doesn't work

DataTable myNewTable = myDataTable.Select("Name <> 'n/a'").CopyToDataTable();

has a row named
. I would like to select the rows from this table where Name is not equal to "n/a". It selects but still am missing the null values i need the null values too.

Can anyone help?


Try this

myDataTable.Select("[Name] is NULL OR [Name] <> 'n/a'" )

Edit: Relevant sources: