Link to home
Start Free TrialLog in
Avatar of countrymeister
countrymeister

asked on

command.ExecuteNonQuery return value

I just would like to know if I excute a stored procedure which does some updates and then some inserts.

What will be the return value , for example it does 6 updates and 10 inserts.
Will it return 16 or just 10.
Avatar of CutSack
CutSack

That's spooky. I was just updating a stored procedure that does something similar.

Mine does 4 updates and 4 inserts and it always returns 8 as the result of ExecuteNonQuery.

Note that if you include SET NOCOUNT ON in your proc, then it won't return anything.
ASKER CERTIFIED SOLUTION
Avatar of CutSack
CutSack

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If your query is dynamic it will also return -1 as the dynamic transaction exists in a different context.
Avatar of countrymeister

ASKER

I had the NOCOUNT set to on. I did read that setting it boosts performance., so I left it as is
But i added another OUT parameter to retrun the rows affected.