Wednesday, 15 August 2012

Entity Framework SQL Parameters not getting supplied -


After the

This gives a number of ways to provide a parameter for a stored procedure.

None of them are working for me

This works:.

  this.PayrollContext.Database.SqlQuery & lt; CSRRateEntity & gt; ("Ord_getCSRRate @csr_num = '4745', @ord_pay_period_id = 784"). To create a list ();  

It does not:

  returned this.PayrollContext.Database.SqlQuery & LT; CSRRateEntity & gt; ("Exec ord_getCSRRate @csr_num, @ord_pay_period_id", New SqlParameter ("Csr_num", "4745"), New SQLPamator ("Ord_Pay_Prood_ID", 784). Ollist ();  

The error message is that the parameter is not provided.

I have tried all the changes that I can think of and can still get the same error message.

This code is already being used, so no import is necessary. SP is found, it is just missing the parameters.

Did you import the stored procedure in edmx?

The implementation that we have stored for this process creates this parameter in such a way:

  on inputIdParameter = inputId.HasValue? New ObjectParameter ("InputId", Input Id): New object parameter ("Input IID", typef (int));  

The result of the stored procedure function is given in this way

  return (IObjectContextAdapter) this. ObjectContext.ExecuteFunction & lt; T & gt; ("[SP_NAME]", input generator);  

No comments:

Post a Comment