To select a column with null value from a DataTable use the following expression:
Isnull(Col,'NULL_COLUMN') = 'NULL_COLUMN'
where Col is the name of the column, 'NULL_COLUMN' is the default return value if the column value is null.
So basically we verify if the value returned equals the anticipated null-return-value; if it does, the column value is NULL and the row containing this column will be added to the results.
string sql = "Isnull(Col,'NULL_COLUMN') = 'NULL_COLUMN'";
string sort = "Col ASC";
DataRow[] result = myTable.Select(sql, sort);
No comments:
Post a Comment