taosdata / taos-connector-csharp

EntityFramework, EF Core, ADO.NET, ORM,Stmt,TDengine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DataReaderExtensions.cs当字段值为null时异常

winnyrain opened this issue · comments

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)

发个修改PR看看?

commented

已提交PR