Description:
It works fine with just one procedure parameter, but when I add one or more i gives me this error. Anyone that have any clue to why?! All I can think of is that NHibernate generates the parameters wrong? And no, it does no matter if if write the parameters with () eg. (:Username :Password).
Hibernate version:
1.2.0.CR2
Mapping documents:
<sql-query name="RegisterSid">
<return-scalar column="Result" type="Int32" />
exec spRegisterSid :Username :Password
</sql-query>
Full stack trace of any exception that occurs:
NHibernateTest.Tests.Data.UserDaoTest.CreateUser : NHibernate.ADOException : could not execute query
[ exec spRegisterSid ? ? ]
Name: Username - Value: Foo
Name: Password - Value: qwerty123
[SQL: exec spRegisterSid ? ?]
----> System.Data.SqlClient.SqlException : Line 1: Incorrect syntax near '@p1'.
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
at NHibernate.Impl.SessionImpl.ListCustomQuery(ICustomQuery customQuery, QueryParameters queryParameters, IList results)
at NHibernate.Impl.SessionImpl.List[T](NativeSQLQuerySpecification spec, QueryParameters queryParameters)
at NHibernate.Impl.SqlQueryImpl.List[T]()
at NHibernateTest.Data.UserDao.Create(String username, String password) in E:\.www\NHibernateTest\NHibernateTest\Data\UserDao.cs:line 42
at NHibernateTest.Tests.Data.UserDaoTest.CreateUser() in E:\.www\NHibernateTest\NHibernateTest.Tests\Data\UserDaoTest.cs:line 36
--SqlException
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
Name and version of the database you are using:
SQL Server 2000 SP3
|