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

前端 未结 2 1672
长情又很酷
长情又很酷 2021-02-04 04:05

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

相关标签:
2条回答
  • 2021-02-04 04:50

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

    DataRow[] myResultSet = myDataTable.Select("[COLUMN NAME] is null");
    
    0 讨论(0)
  • 2021-02-04 04:59

    For one column

    DataRow rows = DataTable.Select("[COLUMN 1]=''");
    

    For more than one column

    DataRow rows = DataTable.Select("[COLUMN 1]='' OR [COLUMN 2]=''");
    
    0 讨论(0)
提交回复
热议问题