更新时间:2022-12-12 14:11:20
你需要一个参数 Direction
设置为 ParameterDirection.ReturnValue
You need a parameter with Direction
set to ParameterDirection.ReturnValue
类似:
SqlParameter returnParameter = deleteCommand.Parameters.Add("RetVal", SqlDbType.Int);
returnParameter.Direction = ParameterDirection.ReturnValue;
...
deleteCommand.ExecuteNonQuery();
...
int returnValue = (int) returnParameter.Value;
你的存储过程当然需要返回这个返回值:
You Stored Procedure needs to return this return value of course:
create proc [dbo].[DeleteParts]
@TransNo nvarchar (6),
@fpart nvarchar(25)
AS
DECLARE @Returns BIT
SET @Returns = 1
...
RETURN @Returns