【发布时间】:2013-05-23 13:09:07
【问题描述】:
如何查找数据表中的列是否为 Null(或)Not。如果我的 Dataset(DS) 包含 1 个 Data_Table 和 2 列。我想检查第 2 列是否为 Null(或)Not。
【问题讨论】:
如何查找数据表中的列是否为 Null(或)Not。如果我的 Dataset(DS) 包含 1 个 Data_Table 和 2 列。我想检查第 2 列是否为 Null(或)Not。
【问题讨论】:
如果您说数据集中有一个 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;
}
【讨论】: