Abey Varghese

Abey Varghese

  • NA
  • 18
  • 9.4k

Return a variable from stored procedure in entity framework

Jun 20 2013 5:31 PM
I Need to return a value from a stored procedure using entity framework.

My stored procedure is.


ALTER
PROCEDURE [dbo].[okc_usp_CheckWorkOrderId]
@TemplateCheck
VARCHAR(12)
,
@FromDate SMALLDATETIME
,
@IDValue NUMERIC (10,0)
,
@WorkOrderID VARCHAR(20)
,
@ChildDate SMALLDATETIME
--@Flag bit OUTPUT

AS
BEGIN
DECLARE
@Flag bit;
set
@Flag=0;
IF(SUBSTRING(@Templatecheck, DATEPART(MONTH,@FromDate),1 ) = 1 AND
NOT EXISTS(SELECT WORKORDERID FROM azteca.WORKORDER WHERE WORKORDERID = @IDValue)
AND NOT EXISTS (SELECT WORKORDERID FROM azteca.WORKORDER WHERE SOURCEWOID = @WorkOrderID
AND FROMDATE = @ChildDate AND CYCLETYPE = 'A'))

BEGIN
Set @Flag = 1
END
ELSE
BEGIN
Set @Flag=0
END

RETURN @Flag


END


My code is:

using (CWPRTestEntities ctx = new CWPRTestEntities())
{

int Flag= ctx.okc_usp_CheckWorkOrderId(TemplateCheck, FromDate, IDValue, WorkorderID, ChildDate);
}

Error: Best overloaded method match for ....has some invalid arguments.

Answers (3)