Entity Framework SQL Parameters not getting supplied -
this thread gives number of ways provide parameter stored procedure.
none of them working me.
this works:
this.payrollcontext.database.sqlquery<csrrateentity>("ord_getcsrrate @csr_num = '4745', @ord_pay_period_id = 784").tolist();
this not:
return this.payrollcontext.database.sqlquery<csrrateentity>("exec ord_getcsrrate @csr_num, @ord_pay_period_id", new sqlparameter("csr_num", "4745"), new sqlparameter("ord_pay_period_id", 784) ).tolist();
the error message parameter not supplied.
have tried variations can think of , still same error message.
this using code first, no import required. sp found, missing parameters.
did import stored procedure edmx?
in implementation have stored procedure creates parameters this:
var inputidparameter = inputid.hasvalue ? new objectparameter("inputid", inputid) : new objectparameter("inputid", typeof(int));
the result of stored procedure function given this
return ((iobjectcontextadapter)this).objectcontext.executefunction<t>("[sp_name]", inputidparameter);
Comments
Post a Comment