Click here to Skip to main content
15,847,077 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Guys, I am trying to connect with sql server using NHibernate from .net application.

Here's what I am trying to do.

var query = DataSession.Session.CreateSQLQuery("EXEC usp_test @Id=:Pid, @Name=:Name");
var returnData = query.List<MyEntity>();

Now I am able to get the data successfully. The problem is that I want proc to send me some output values as well. So I have increased the output parameters in my proc. But don't know how to do that here in CreateSQLQuery Method.

I have already googled it, but they have implemented it using SqlCommand and all that, including SqlDataReader. I don't wanna do that.

Any help will be much appreciated.
Richard Deeming 1-Oct-15 11:29am    
If you'd read any of the Google results, you'd see that it isn't possible to use output parameters with CreateSQLQuery.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900