这返回-1,我怎样才能从存储过程中获得实际的返回值?
这是我的存储过程
ALTER PROCEDURE [Production].[Select_TicketQuantity]
@Ticket NVARCHAR(25),
@Reference NVARCHAR(20)
AS
BEGIN
declare @SQL nvarchar (4000)
SET @SQL = 'select QARTCOL as Quantidade from D805DATPOR.GCARCCR1 where NCOLGIA = ' + @Ticket + ' AND NARTCOM = ''' + @Reference + ''''
SET @SQL = N'select CONVERT(int,Quantidade) as Quantidade from OpenQuery(MACPAC, ''' + REPLACE(@SQL, '''', '''''') + ''')'
PRINT @SQL
EXEC (@SQL)
END
C# 代码
int? quantity= 0;
try
{
quantity= await _context.Database.ExecuteSqlRawAsync("EXEC Production.Select_TicketQuantity @p0, @p1", parameters: new[] { ticket, reference});
}
catch (Exception ex)
{
_logger.LogError($"{ex}");
return RedirectToPage("Index");
}