gpt4 book ai didi

c# - 休眠 Antlr.Runtime.NoViableAltException

转载 作者:太空狗 更新时间:2023-10-29 22:07:39 35 4
gpt4 key购买 nike

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/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com