类型转换异常 返回
吾之五 发布于1个月前
demo环境:达梦企业版,程序demo解决方案下包含建表脚本,见【demo.sql】
查询1、2、3都正常,查询4包类型转换异常,如下图所示

具体源码中的报错位置,如下图所示

进行如下修改便可正常查询,新增decimal转sbyte,byte,ushort,short,uint,ulong
【if (kv.Value is decimal && UtilMethods.GetUnderType(propertyInfo.PropertyType).IsIn(typeof(int),typeof(long)))】改成
【if (kv.Value is decimal && UtilMethods.GetUnderType(propertyInfo.PropertyType).IsIn(typeof(sbyte), typeof(byte),typeof(ushort),typeof(short), typeof(int),typeof(uint), typeof(long), typeof(ulong)))】
不知作者原从哪些方便考虑这里只支持decimal转int和long

热忱回答(4)
-
fate sta VIP0
1个月前加个convert.tolint16 某个字段类型是int16
0 回复 -
fate sta VIP0
1个月前在select加函数转换。
0 回复 -
吾之五 VIP0
1个月前@fate sta:
这里包含字段Id(int16) 和 Tsmid(uint)
但不管convert方法加载哪里都依旧报图二中的错误

0 回复 -
吾之五 VIP0
1个月前另再补充所用实体配置

0 回复