Masoumeh Karvar
Masoumeh Karvar

Reputation: 801

Send list of int to sql sp throught dapper dynamic parameters

I need to call a sql stored procedure which have an input parameter with type "IntList" that is a user-defined table type,I wanna set this parameter with a list of int through dapper dynamic parameter, in this case I don't have Structured dbtype, how can I handle it? I've tried this :

   using var connection = _dbConnectionFactory.GetDefaultServerConnectionString();

            var parameters = new DynamicParameters();
            parameters.Add("@RequestId", query.RequestId, DbType.DateTime);
            parameters.Add("@Agencies", query.AgencyIds);

            return await connection.QueryAsync<TerminalDto>(
                "SelectTerminals", parameters,
                commandType: CommandType.StoredProcedure);

but it raise "too many arguments" error!

Upvotes: 1

Views: 1766

Answers (0)

Related Questions