- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有这个
return session.Query<CoursePermission>().Where(x => x.Student.StudentId == studentId).ToList();
我明白了
NHibernate.Exceptions.GenericADOException was unhandled by user code
Message=could not execute query
[ select courseperm0_.PermissionId as Permissi1_3_, courseperm0_.Owner as Owner3_, courseperm0_.Add as Add3_, courseperm0_.Edit as Edit3_, courseperm0_.Delete as Delete3_, courseperm0_.View as View3_, courseperm0_.StudentId as StudentId3_, courseperm0_.CourseId as CourseId3_ from CoursePermissions courseperm0_ where courseperm0_.StudentId=@p0 ]
Name:p1 - Value:757f27a2-e997-44f8-b2c2-6c0fd6ee2c2f
[SQL: select courseperm0_.PermissionId as Permissi1_3_, courseperm0_.Owner as Owner3_, courseperm0_.Add as Add3_, courseperm0_.Edit as Edit3_, courseperm0_.Delete as Delete3_, courseperm0_.View as View3_, courseperm0_.StudentId as StudentId3_, courseperm0_.CourseId as CourseId3_ from CoursePermissions courseperm0_ where courseperm0_.StudentId=@p0]
Source=NHibernate
SqlString=select courseperm0_.PermissionId as Permissi1_3_, courseperm0_.Owner as Owner3_, courseperm0_.Add as Add3_, courseperm0_.Edit as Edit3_, courseperm0_.Delete as Delete3_, courseperm0_.View as View3_, courseperm0_.StudentId as StudentId3_, courseperm0_.CourseId as CourseId3_ from CoursePermissions courseperm0_ where courseperm0_.StudentId=@p0
StackTrace:
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
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.Hql.Ast.ANTLR.Loader.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)
at NHibernate.Impl.ExpressionQueryImpl.List()
at NHibernate.Linq.NhQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
at NHibernate.Linq.NhQueryProvider.Execute(Expression expression)
at NHibernate.Linq.NhQueryProvider.Execute[TResult](Expression expression)
at Remotion.Data.Linq.QueryableBase`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at PermissionLevelRepo.GetPermission(Guid studentId) line 28
at For(String email) in :line 63
at (String email) in :line 50
at PlannerController.Tab() :line 43
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.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
InnerException: System.Data.SqlClient.SqlException
Message=Incorrect syntax near the keyword 'Add'.
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=15
LineNumber=1
Number=156
Procedure=""
Server=mssql.frostyserver.com
State=1
StackTrace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
InnerException:
最佳答案
看起来 StudentId
是一个 Guid
。尝试:
return session
.Query<CoursePermission>()
.Where(x => x.Student.StudentId.Equals(studentId))
.ToList();
编辑:内部异常:
Message=Incorrect syntax near the keyword 'Add'
生成的 sql 有一个名为 Add 的列,请尝试在您的映射规则中重命名它。
select courseperm0_.PermissionId as Permissi1_3_, courseperm0_.Owner as Owner3_, courseperm0_.Add as Add3_, ...
关于c# - NHibernate.Exceptions.GenericADOException 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5386894/
我正在尝试将 NHibernate 与 ByCode 映射结合使用,但收效甚微。知道我做错了什么吗? 我的 table : CREATE TABLE [dbo].[activities]( [
我有这个 return session.Query().Where(x => x.Student.StudentId == studentId).ToList(); 我明白了 NHibernate
我有两个表,tableA 和 tableB。 tableA 有列:tabAId、col2、col3 (tabAId primaryKey 和 Identity 列。) tableB 有列:tabAId
我有一个 NHibernate 查询(它正在填充一个 EXTJS 网格) 它向数据库发出 2 个查询,一个用于获取记录计数(用于分页),另一个用于获取前 N 行以填充网格。 从代码中,我一直在 Sel
我有一个遗留应用程序 (vfp 8),我需要从中提取数据(无插入)。我使用 Accnum 字段作为主键,它在表中定义为字符 11。 出厂配置: NHibernate.Connection.Dr
通过 mysql 更新时出现异常,同样的代码适用于 microsoft sql。 mysql服务器版本5.6.28 string connectionString = "Server=xxxx.is;
我有以下看似随机发生的异常: NHibernate.Exceptions.GenericADOException: could not execute query [ select b
我一直在使用 ISession.Refresh() 遇到奇怪的行为(至少对我而言) . 我有一个带有延迟加载的子项集合的实体,以及一个命中该集合的只读属性,所有这些都包含在二级缓存中。 我用 ISes
我捕获了 InnerException.Message = "Unique key violation ..."的 GenericADOException,用于告诉用户输入的登录名已被使用。 之后我试
我是一名优秀的程序员,十分优秀!