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

前端 未结 8 1405
梦毁少年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:22

    ExecuteNonQuery will return the number of rows affected but NOT data (that's why its a non-query). So it won't bring anything back.

    This might be useful to read:

    http://www.dreamincode.net/forums/topic/76434-executenonquery-with-output-parameters/

    You'll need to use a different mechanism to get your data out - how about ExecuteReader with an output parameter?

提交回复
热议问题