return NHibernateSession.CreateQuery(@"TRUNCATE TABLE dbo.Exceptions").ExecuteUpdate();
Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. [TRUNCATE TABLE Exceptions] Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. [TRUNCATE TABLE Exceptions]
Source Error:
知道为什么吗?
最佳答案
TRUNCATE TABLE 不是有效的 HQL 语句。
使用CreateSQLQuery
代替CreateQuery
来执行SQL语句。
关于c# - 休眠 Antlr.Runtime.NoViableAltException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3799087/