Accessing SQL Server stored procedure output parameter in C#

前端 未结 5 665
没有蜡笔的小新
没有蜡笔的小新 2020-12-19 18:08

I have a simple SQL Server stored procedure:

ALTER PROCEDURE GetRowCount

(
@count int=0 OUTPUT
)

AS
Select * from Emp where age>30;
SET @count=@@ROWCOUN         


        
5条回答
  •  一生所求
    2020-12-19 18:45

    you have to specify that it is a stored procedure not a query

    cmd.CommandType = CommandType.StoredProcedure;
    

提交回复
热议问题