c#项目出现类型“System.Decimal”的对象无法转换为类型“System.Int32”。异常,下划线

.Net技术 码拜 7年前 (2017-05-02) 3687次浏览
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Omu.ValueInjecter;
namespace MadMan.Li.Common.Data
{
public class ReaderInjection : KnownSourceValueInjection<IDataReader>
{
protected override void Inject(IDataReader source, object target)
{
for (var i = 0; i < source.FieldCount; i++)
{
var activeTarget = target.GetProps().GetByName(source.GetName(i),true);
if (activeTarget == null) continue;
var value = source.GetValue(i);
if (value == DBNull.Value) continue;
activeTarget.SetValue(target, value);
}
}
}
}
解决方案

60

加在SQL语句里面啊~~~

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明c#项目出现类型“System.Decimal”的对象无法转换为类型“System.Int32”。异常,下划线
喜欢 (0)
[1034331897@qq.com]
分享 (0)