Reputation: 5730
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
Upvotes: 27
Views: 114266
Reputation: 1031
The correct way to check for null is to check for it:
DataRow[] myResultSet = myDataTable.Select("[COLUMN NAME] is null");
Upvotes: 103
Reputation: 3438
For one column
DataRow rows = DataTable.Select("[COLUMN 1]=''");
For more than one column
DataRow rows = DataTable.Select("[COLUMN 1]='' OR [COLUMN 2]=''");
Upvotes: 7