mixing output params and input params on stored proc does not seem to work, but when changed to both output, it does work
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);
}