如题:
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
大神求解..多谢
占时没分了..
exec proc1是mssql的方式
call proc1才是mysql的执行方式