首页 新闻 会员 周边

NHibernate不能直接通过CreateSQLQuery执行存储过程

0
[待解决问题]

如题:

1.CreateCommand方式

IDbCommand cmd = session.Connection.CreateCommand();

cmd.CommandText = "proc1";

cmd.CommandType = CommandType.StoredProcedure;
IDataReader da = cmd.ExecuteReader();

可执行查询到数据。

2.ISQLQuery 方式

Sessions..CreateSQLQuery("exec proc1").List();

却不能执行存储过程,提示错误:

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'exec proc1' at line 1"}

could not execute query
[ exec proc1 ]
[SQL: exec proc1]

难道版本不对?我这NHibernate是最新的4.0的 mysql是5.6.21

大神求解..多谢

占时没分了..

迷失路灯的主页 迷失路灯 | 初学一级 | 园豆:7
提问于:2015-01-19 15:42
< >
分享
所有回答(1)
0

exec proc1是mssql的方式

call proc1才是mysql的执行方式

迷失路灯 | 园豆:7 (初学一级) | 2015-01-19 15:51
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册