/// <summary>
/// 获得某列在表中是否为NULL值
/// 这是一个静态方法,可以直接调和
/// </summary>
/// <param name="myTable">表</param>
/// <param name="myColumn">列</param>
/// <returns>bool:如果是NULL值则为TRUE,否则为FALSE</returns>
public static bool GetColumnIsNull(DataTable myTable, BaseDataColumn myColumn)
{
bool IsNull = true;
//检查此列在此表的所有行中是否全都为null值,如果是,则此列的值为null,-100表示是主从表设的默认值
for (int i = 0; i < myTable.Rows.Count; i++)
{
//wuwd修改20070320 如果是强制更新字段跳过
if (myColumn.Force_Update|| (!Convert.IsDBNull(myTable.Rows[i][myColumn.ColumnName]) && myTable.Rows[i][myColumn.ColumnName].ToString() != "-100"))
{
IsNull = false;
break;
}
}
return IsNull;
}
DataSet:
#region 强制更新列
/// <summary>
/// 强制更新列,主要用于更新日期列 wuwd20070320
/// </summary>
/// <param name="strTableName">表名</param>
/// <param name="arrColomns">更新列名集合</param>
public void Force_UpdateColumn(string strTableName,ArrayList arrColomns)
{
DataColumnCollection columns = this.Tables[strTableName].Columns;
for(int i = 0; i < arrColomns.Count; i ++)
{
((BaseDataColumn)columns[arrColomns[i].ToString()]).Force_Update = true;
}
}
/// <summary>
/// 重写:强制更新列,主要用于更新日期列 wuwd20070320
/// </summary>
/// <param name="intTableIndex">表名</param>
/// <param name="arrColomns">更新列名集合</param>
public void Force_UpdateColumn(int intTableIndex,ArrayList arrColomns)
{
DataColumnCollection columns = this.Tables[intTableIndex].Columns;
for(int i = 0; i < arrColomns.Count; i ++)
{
((BaseDataColumn)columns[arrColomns[i].ToString()]).Force_Update = true;
}
}
#endregion
BaseDataColumn:
// TurnPage Column 分页字段
public bool Force_Update
{
get { return isForce_Update; }
set { isForce_Update = value; }
}