Skip to content

mixing output params and input params on stored proc does not seem to work, but when changed to both output, it does work#39

Description

@westpicoblvd

If I'm mapping a stored proc with one output param and one input param, exceptions are thrown 馃憤
SqlException: The formal parameter "@QueueId" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output.

Please advise, it does not matter what order I change the args to stored proc, but when they are both output, it works.

SqlException: The formal parameter "@QueueId" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output.

SQL:

**alter procedure [TM].[TaskInputZombie5]
(
@message nvarchar(400) output,@QueueId int

)
as
begin
declare @iErr int = 10
select @QueueId = @iErr * @iErr

set @message = @message + 'more: ' + CONVERT(nvarchar(40),@QueueId)
return 0
end**
c#:

    public int TaskInputZombie5(
        [Parameter(DbType = "int", ClrType = typeof(int), Name = "QueueId")] ObjectParameter QueueId,
        [Parameter(DbType = "nvarchar", ClrType = typeof(string), Name = "Message")] ObjectParameter Message)
    {
  
        ObjectParameter[] paramsObjectParameter = new ObjectParameter[2];
        paramsObjectParameter[0] = Message;
        paramsObjectParameter[1] = QueueId;
        return this.ObjectContext().ExecuteFunction(nameof(this.TaskInputZombie5),
            paramsObjectParameter);
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions