DataTale中判断某个字段中是否包含某个数据
/// <summary> /// 判断DataTale中判断某个字段中包含某个数据 /// </summary> /// <param name="dt"></param> /// <param name="columnName"></param> /// <param name="fieldData"></param> /// <returns></returns> public static Boolean IsColumnIncludeData(DataTable dt, String columnName, string fieldData) { if(dt==null) { return false; } else { DataRow[] dataRows = dt.Select(columnName+"='"+fieldData+"'"); if (dataRows.Length.Equals(1)) { return true; } else { return false; } } }