Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use DataTable.Select() to select Null/ empty values?

Tags:

My data table filled from db is having empty values in some cells.

The results database SP return has Null in them but in DataTable these values are appearing as '' or empty cells.

Please guide me how to use Select() to select these dbnull/ empty rows.

Thanks

like image 238
haansi Avatar asked Feb 17 '12 06:02

haansi


People also ask

How to select records with NO NULL values in sql server?

Below is the syntax to filter the rows without a null value in a specified column. Syntax: SELECT * FROM <table_name> WHERE <column_name> IS NOT NULL; Example: SELECT * FROM demo_orders WHERE ORDER_DATE IS NOT NULL; --Will output the rows consisting of non null order_date values.

Can DataTable be NULL?

If a DataTable is null then you can't copy anything to it: there isn't anything to copy into!


1 Answers

The correct way to check for null is to check for it:

DataRow[] myResultSet = myDataTable.Select("[COLUMN NAME] is null"); 
like image 54
James McG Avatar answered Sep 22 '22 05:09

James McG