The intension is If it returns 1, means inserted. If returns 0, means updated. When I execute the sp in SSMS, it returned 1 or 0 correctly, but C# returnNum always got 1. If I set nocount on in stored procedure, it always got -1. Can someone please help? Thanks.
In stored procedure
In C# code
In stored procedure
C#:
stored procedure
if (not exist)
begin
insert
return @@ROWCOUNT
end
else
begin
update
return 0
end
In C# code
C#:
int returnNum = CommonMethods.ExecuteSql('EXEC Procedure1')
Last edited: