标签:
最近公司的一个项目,在本地调试都ok,但一发布到测试环境就报异常:
MessageText=System.ArgumentException: Value does not fall within the expected range.
at Oracle.DataAccess.Client.OracleParameter.set_Value(Object value)
at IBatisNet.DataMapper.TypeHandlers.Nullables.NullableBooleanTypeHandler.SetParameter(IDataParameter dataParameter, Object parameterValue, String dbType)
at IBatisNet.DataMapper.Configuration.ParameterMapping.ParameterMap.SetParameter(ParameterProperty mapping, IDataParameter dataParameter, Object parameterValue)
at IBatisNet.DataMapper.Commands.DefaultPreparedCommand.ApplyParameterMap(ISqlMapSession session, IDbCommand command, RequestScope request, IStatement statement, Object parameterObject)
at IBatisNet.DataMapper.Commands.DefaultPreparedCommand.Create(RequestScope request, ISqlMapSession session, IStatement statement, Object parameterObject)
at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteInsert(ISqlMapSession session, Object parameterObject)
at IBatisNet.DataMapper.SqlMapper.Insert(String statementName, Object parameterObject)
at Framework.Zhaogang.Data.DbContext.Insert(String statementName, Object parameterObject)
at Framework.Zhaogang.Data.Dao`1.Insert(TEntity entity)
at Feature.Zhaogang.Settlement.Application.Biz.CostaccountingBiz.AddFinInStorageAndItems(List`1 finInStorageEntityList, String& msg, List`1& idCodeResultList)
经过一步步排查,最后确定是 代码的实体中用了bool值,但oracle用的是NUMBER(1) 导致的。而本地和测试服务器配置文件中用的oracle驱动版本不同,一个4.0,一个11.2,结果是本地api功能ok,服务器api异常。
最后把bool型的属性都改为long才解决的。
oracle NUMBER(1) 与 c# bool 的奇葩问题
标签:
原文地址:http://www.cnblogs.com/junblog/p/4398303.html