Pass a list to a stored procedure in linQ to sql

Viewed 371

I defined table type "Int array" in T-SQL and use it as a stored procedure input parameter.

I wrote this code:

[global::System.Data.Linq.Mapping.FunctionAttribute(Name = "[dbo].sp_GetAllLicense ")]
[ResultType(typeof(sp_GetAllLicenseResult))]
[ResultType(typeof(int))]

public IMultipleResults sp_GetAllLicense(
    [global::System.Data.Linq.Mapping.ParameterAttribute(Name = "FromDate", DbType = "NVarChar(10)")] string fromDate,
    [global::System.Data.Linq.Mapping.ParameterAttribute(Name = "EndDate", DbType = "NVarChar(10)")] string endDate, 
    [global::System.Data.Linq.Mapping.ParameterAttribute(Name = "License", DbType = "int")] int a, 
    [global::System.Data.Linq.Mapping.ParameterAttribute(Name = "City", DbType = "Structured")] IEnumerable <int> City,
    [global::System.Data.Linq.Mapping.ParameterAttribute(Name = "ProductID", DbType = "Structured")] IEnumerable<int> ProductID, 
    [global::System.Data.Linq.Mapping.ParameterAttribute(Name = "NoeFaaliat", DbType = "Structured")] IEnumerable<int> NoeFaaliat)

{
    IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), fromDate, endDate,a,City,ProductID,NoeFaaliat );
    return (IMultipleResults)(result.ReturnValue);
}

City, productID and activity are my 3 int array parameters, that I can't work with them.

I change their "DBType" and their type but now I get this error:

Failed to convert parameter value from a list 1 to an IEnumerable`1

0 Answers
Related