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.
What will be the return value , for example it does 6 updates and 10 inserts.
Will it return 16 or just 10.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If your query is dynamic it will also return -1 as the dynamic transaction exists in a different context.
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.
But i added another OUT parameter to retrun the rows affected.
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.