Error when calling SQL SP via LINQ

Posted by PaulC on Stack Overflow See other posts from Stack Overflow or by PaulC
Published on 2010-05-05T21:30:33Z Indexed on 2010/05/05 21:48 UTC
Read the original article Hit count: 318

Filed under:
|
|

Newbie problem: I have a SQL SP with ten parameters (eight input, two output) but when I attempt to call it via LINQ from code I get the following error message:

"The best overloaded method match for 'DataClassesDataContext.ST_CR_CREATE_CASE_BASIS(string, string, string, string, System.DateTime?, string, string, string, ref int?, ref int?)' has some invalid arguments".

The params with ? appear to be unrecognized, but I'm baffled: the data types match the SQL types, the number of parameters match, the other parmeters don't exhibit the same behaviour. Can anyone tell me what's going on? Thanks in advance.

-- SQL SP:

create procedure ST_CR_CREATE_CASE_BASIS

@p_Pers_No      nvarchar (50),
@p_Subject      nvarchar (255),

@p_RQ_XML       nvarchar(max),
@p_RQ_XSL       nvarchar(max),
@p_Date_Submit      smalldatetime,
@p_User_ID_Submit   nvarchar (255),
@p_RQ_Status        nvarchar (50),
@p_User_ID_OnBehalf     nvarchar (255),

@p_Case_Number      int output,
@p_RQ_ID        int output

as
begin

 -- ... etc.; the SP works fine when called from SSMS

The code-behind proc from the aspx page looks like this:

protected void cmdSubmit_Click(object sender, EventArgs e)
{

    using (DataClassesDataContext vDataCont = new DataClassesDataContext())
    {
        Int32 vNewCaseNr;
        Int32 vNewReqNr;
        DateTime vNow = System.DateTime.Now;

        vDataCont.ST_CR_CREATE_CASE_BASIS("101", "Test Subject Late Wed", null, null, vNow , "101", "1", "101", ref vNewCaseNr, vNewReqNr);
     }

}

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about linq-to-sql