【问题标题】:Find whether a column is null or not in Dataset在数据集中查找列是否为空
【发布时间】:2013-05-23 13:09:07
【问题描述】:

如何查找数据表中的列是否为 Null(或)Not。如果我的 Dataset(DS) 包含 1 个 Data_Table 和 2 列。我想检查第 2 列是否为 Null(或)Not

【问题讨论】:

    标签: datatable null dataset


    【解决方案1】:

    如果您说数据集中有一个 2 列表,那么请执行...

    isColumnEmpty = false;
    DataColumn column = dataSet.Tables[0][1]; // get column 2 from table 1
    foreach(DataRow row in column)
    {
        if (row[0] == null) // check the only column of this row
            then isColumnEmpty = true;
        break;
    }
    

    【讨论】:

      猜你喜欢
      • 2012-02-28
      • 1970-01-01
      • 2017-02-20
      • 2017-01-10
      • 1970-01-01
      • 1970-01-01
      • 2022-12-17
      • 2012-05-03
      • 2013-06-19
      相关资源
      最近更新 更多