Best way to check if a Data Table has a null value in it

前端 未结 6 1247
感情败类
感情败类 2020-11-27 02:34

what is the best way to check if a Data Table has a null value in it ?

Most of the time in our scenario, one column will have all null values.

(This datatabl

6条回答
  •  独厮守ぢ
    2020-11-27 03:33

    foreach(DataRow row in dataTable.Rows)
    {
        if(row.IsNull("myColumn"))
            throw new Exception("Empty value!")
    }
    

提交回复
热议问题