更新时间:2023-11-27 17:48:52
该错误消息非常清楚,您的存储过程在从 C# 代码传递参数时不需要任何参数.
The error message is pretty clear that your stored procedure does not expects any parameter while from c# code you are passing parameter.
实际上,您在存储过程中指定了一个变量而不是参数,您需要在 SP 名称参数之后使用它的数据类型指定它,在您的情况下,OUTPUT
关键字作为它的输出参数.
Actually you have specified a variable in your stored procedure not a parameter, you will need to specify it just after the SP name parameter with it's datatype and in your case OUTPUT
keyword as it output parameter.
应该是:
ALTER procedure [dbo].[spCaller] @URL NVarChar(255) OUTPUT
.......
.......
您的最终存储过程将类似于:
Your final stored procedure would be like:
ALTER procedure [dbo].[spCaller] @URL NVarChar(255) OUTPUT
AS BEGIN
EXECUTE spBuscarUrl
'MIREX-2017-00001', @url = @URL OUTPUT;
select @URL
END
你可以看看这篇文章 解释了如何将不同类型的参数传递给存储过程.
You can have a look at this post explaining how to pass different kind of parameters to a Stored Procedure.
希望有帮助!