nHibernate结果变换器错误

时间:2016-07-08 18:04:12

标签: nhibernate

这有什么问题?

如果我将查询剪切并粘贴到SSMS中的脚本中(并将其正确地格式化为查询),则代码将在SQL中执行而不会出现错误。 所以问题出在答复中。

'yourordernumber'在hbm.xlm映射中定义为字符串,并作为varchar从SQL Server返回。

我想我还有两个问题。为什么错误异常消息不能包含对查询脚本进行简单剪切和粘贴的文本?而且,为什么错误文本实际上不能简单地告诉我它有什么问题?

NHibernate.Exceptions.GenericADOException was unhandled by user code
  HResult=-2146232832
  Message=could not execute query
[ exec OrderLinUpdate
      @Mode=@p0
        , @OrderHdrRecid=@p1
        , @LinNo=@p2
        , @ItemRecid=@p3
        , @QtyRequested=@p4
        , @LoadIDsList=@p5
        , @ItemSelectMethod=@p6
        , @ModifiedBy=@p7 ]
  Name:Mode - Value:Add  Name:OrderHdrRecid - Value:51  Name:LinNo - Value:-1  Name:ItemRecid - Value:97  Name:QtyRequested - Value:1  Name:LoadIDsList - Value:OS 001.0001.1??20300  Name:ItemSelectMethod - Value:SearchLoadID  Name:ModifiedBy - Value:0
[SQL: exec OrderLinUpdate
      @Mode=@p0
        , @OrderHdrRecid=@p1
        , @LinNo=@p2
        , @ItemRecid=@p3
        , @QtyRequested=@p4
        , @LoadIDsList=@p5
        , @ItemSelectMethod=@p6
        , @ModifiedBy=@p7]
  Source=NHibernate
  SqlString=exec OrderLinUpdate
      @Mode=@p0
        , @OrderHdrRecid=@p1
        , @LinNo=@p2
        , @ItemRecid=@p3
        , @QtyRequested=@p4
        , @LoadIDsList=@p5
        , @ItemSelectMethod=@p6
        , @ModifiedBy=@p7
  StackTrace:
       at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer)
       at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
       at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes)
       at NHibernate.Impl.SessionImpl.ListCustomQuery(ICustomQuery customQuery, QueryParameters queryParameters, IList results)
       at NHibernate.Impl.AbstractSessionImpl.List(NativeSQLQuerySpecification spec, QueryParameters queryParameters, IList results)
       at NHibernate.Impl.AbstractSessionImpl.List(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
       at NHibernate.Impl.SqlQueryImpl.List()
       at NHibernate.Impl.AbstractQueryImpl.UniqueResult()
       at TKOSMERP.Controllers.ERP.ERPController.OrderLinUpdate(FormCollection pd) in C:\_TKOSVNRepos\TKOSM_ERP\TKOSM_ERP\Controllers\ERP\ERPController_ODELine.cs:line 36
       at lambda_method(Closure , ControllerBase , Object[] )
       at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
       at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
  InnerException: 
       HResult=-2146233080
       Message=yourordernumber
       Source=System.Data
       StackTrace:
            at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
            at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
            at NHibernate.Driver.NHybridDataReader.GetOrdinal(String name)
            at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name)
            at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name, ISessionImplementor session, Object owner)
            at NHibernate.Loader.Custom.CustomLoader.ScalarResultColumnProcessor.Extract(Object[] data, IDataReader resultSet, ISessionImplementor session)
            at NHibernate.Loader.Custom.CustomLoader.ResultRowProcessor.BuildResultRow(Object[] data, IDataReader resultSet, Boolean hasTransformer, ISessionImplementor session)
            at NHibernate.Loader.Custom.CustomLoader.GetResultColumnOrRow(Object[] row, IResultTransformer resultTransformer, IDataReader rs, ISessionImplementor session)
            at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies, IResultTransformer forcedResultTransformer)
            at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer)
            at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer)
            at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer)
       InnerException: 

- 更新 我想到了。我正在执行的查询中有一个额外的疑难解答'select'语句。因此,proc实际上返回了两个记录集;一个非常普遍和可识别的情况(也是一个不是问题的情况)但执行文本中的情况是否已确定?

1 个答案:

答案 0 :(得分:0)

我明白了。我正在执行的查询中有一个额外的故障排除'select'语句。因此,proc实际上返回了两个记录集;一个非常普遍和可识别的情况(也是一个不是问题的情况)但执行文本中的情况是否已确定?