DataReaderExtensions.cs当字段值为null时异常
winnyrain opened this issue · comments
Leckun commented
其中里面的好几个函数都有这句:
if (dataReader[i] != DBNull.Value)
但当数据字段为空null时,这个判断不会生效,继续执行下一句Convert.ChangeType会报异常
InvalidCastException: Null object cannot be converted to a value type.
应该改为
if (dataReader[i] !=null && dataReader[i] != DBNull.Value)
MysticBoy commented
发个修改PR看看?
Leckun commented
已提交PR