protected static DateTime GetDateTimeByObject(NamedNullMappingDataReader readerEx, string colName) { int index = readerEx.GetOrdinal(colName); object value = readerEx.GetValue(index); if (value.GetType() != typeof(DateTime)) { return(DateTime.Parse(value.ToString())); } return((DateTime)value); }