So I'm trying to retrieve a value from an INT
, not an INT NOT NULL
, column by means of
AnswerVal = !dataReader.IsDBNull(5) ? dataReader.GetInt32(5) : null
where AnswerVal
is of type int?
and I'm getting the compile-time error
type of conditional expression cannot be determined because because there is no implicit conversion between 'int' and null
Any idea what's going wrong here?
And yes, I've looked at SQL Data Reader - handling Null column values, and I don't understand what I'm doing wrong because my inline if/else is equivalent to the answer there.