In C# how to get return value from stored procedure using ExecuteNonQuery

前端 未结 8 1422
梦毁少年i
梦毁少年i 2020-12-06 07:03

I have the following query:

create proc [dbo].[DeleteParts] 
    @TransNo nvarchar (6), @fpart nvarchar(25) 
AS 
    DECLARE @Returns BIT 
    SET @Returns =         


        
8条回答
  •  盖世英雄少女心
    2020-12-06 07:38

    you must specify output type in stored procedures like this

    @IDout                  [int] output
    

    then add this parameter

    SPParamReturnCollection sp = new SPParamReturnCollection();
            sp.Add(new SPParams { Name = "IDout", ParamDirection = ParameterDirection.Output, Type = SqlDbType.Int });
    

提交回复
热议问题