How to use OUT parameters in LINQ

My stored procedure uses only parameters. I want to use these options in a My MVC application. May I learn how to use parameters in LINQ. What am I doing

[global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.Usp_Insert_Id")]
public int Usp_Insert_Id(
    [global::System.Data.Linq.Mapping.ParameterAttribute(Name="EmpID", DbType="Int")]
    System.Nullable<int> EmpID)
{
    IExecuteResult result =
       this.ExecuteMethodCall(
            this,
            ((MethodInfo)(MethodInfo.GetCurrentMethod())),
            EmpID);
    return ((int)(result.ReturnValue));
}

in an Im controller using

int output = 0;
output = dataContext.Usp_Insert_Id(Id,ref output);

My saved procedure for this

create procedure Usp_Insert_Id ( @Id
int, @Return int out ) as insert into
Emplyee(ID,Date_TIME,Status)
values (@Id,GETDATE(),1)

select @Return=SCOPE_IDENTITY()

Tell me what am I doing wrong?

+5
source share

All Articles