2
votes

Hope you guys can help me.

This is my situation.

I have a stored procedure that returns a very dynamic #table (the number of columns are not fixed)

It accepts 4 parameters.

ALTER PROCEDURE cct_AbsHoursPossible
    @_TpCode VarChar(9),
    @_Period VarChar(20),
    @_StartDate DateTime,
    @_EndDate DateTime
AS
    SET NOCOUNT ON
    SET FMTONLY OFF

I include the stored procedure in my model, and I added the function import and created the complex type.

BUT when I call the stored procedure with the following code

ctx.cct_AbsHoursPossible("V109   03", "A%", _start, _end);

It gives me the following error.

*Procedure or function 'cct_AbsHoursPossible' expects parameter '@_TpCode', which was not supplied.*

I have searched the web and could not come up with any solutions.

I am pretty new to .net development..

Please any help will be appreciated.

1
Do you get the same problem if you use an nvarchar instead of a varchar?PhonicUK
Yes, Exactly the same problem.Apoc21
And if you remove _ from the beginning of the parameter names? Look at the definition for the cct_AbsHoursPossible method and check the parameter names match.PhonicUK
Having the stored procedure return different result sets (different shapes, e.g. number and types of columns) makes it next to impossible to use this from Entity Framework. Also, I'd say such a stored procedure is a bad design - it makes it very hard in any case to deal with that procedure - don't do that!marc_s
THANKS!!, that sorts at least my Parameter error out, FINALLY.Apoc21

1 Answers

0
votes

Remove the underscores from the beginning of your parameter names.