Page 1 of 1

Calling Stored Procedure with Out Parameter

Posted: Thu 02 Jun 2011 12:50
by pradeepdaasari
Hi,

Can any one please explain how can i execute the stored procedure with out parameter?

I have added the stored procedure in the functions in my context,i have selected the returned collection type as None. If i select the None stored procedure is not getting available in the context.

Please provide the solution.

Thanks,
Pradeep

Re: Calling Stored Procedure with Out Parameter in EF

Posted: Thu 02 Jun 2011 12:54
by pradeepdaasari
pradeepdaasari wrote:Hi,

Can any one please explain how can i execute the stored procedure with out parameter in entity framewrok?

I have added the stored procedure in the functions in my context,i have selected the returned collection type as None. If i select the None stored procedure is not getting available in the context.

Please provide the solution.

Thanks,
Pradeep

Posted: Thu 02 Jun 2011 16:01
by AndreyR
Use the following steps:
1. Add the Devart Entity model to your project. Select the necessary procedure in the DB Objects tree.
2. Go to Model Explorer, find this procedure in the Model.Store->Stored Procedures node, and drag this procedure onto the designer surface.
3. Call this procedure using a code as in the following example:

Code: Select all

using(MyEntities context = new MyEntities()) {
  int? par = null;
  context.MyStoredProc(ref par);
}