Arun Chandran C Arun Chandran C - 1 year ago 111
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?

Answer Source

Try this

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

Edit: Relevant sources:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download