I am trying to get the presence of rows based on the passed col. The column is coming from the database as MultiSelect.
bool bCFPresent = IsMultiSelectCFPresent(dvDataTag, "MultiSelect");
public static bool IsPresent(DataView dvDataTag, string colName)
{
return ((from DataRowView drv in dvDataTag
where drv.Row.Field<short>(colName) == 1
select drv).Count() > 0 ? true : false);
}
But I am getting this error:-
System.InvalidCastException was unhandled by user code
Message="Specified cast is not valid." Source="System.Data.DataSetExtensions" StackTrace: at System.Data.DataRowExtensions.UnboxT`1.ValueField(Object value) at System.Data.DataRowExtensions.Field[T](DataRow row, String columnName)
Please help .