2010-09-26 18 views
5
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.nhibernate Antlr.Runtime.NoViableAltException

Exception Details: NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. [TRUNCATE TABLE Exceptions]

Source Error:

neden bir fikrin?

cevap

18

TRUNCATE TABLE geçerli bir HQL ifadesi değil.

SQL ifadelerini çalıştırmak için CreateQuery yerine CreateSQLQuery kullanın.

+2

Evet, doğru cevap bu. Yardım için –

+0

thx Diego. – senzacionale

+0

Konu dışı: NHibernate neden bir ANTLR istisnası gösteriyor? Kullanıcının bunu nasıl ele alması gerekiyor? InvalidQuerySyntaxException veya neyi atmamalı? –