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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
Sorry, should have been more specific, with SET NOCOUNT ON the proc will return -1.

Otherwise, it will return the total number of rows affected by the query (both insert and update).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If your query is dynamic it will also return -1 as the dynamic transaction exists in a different context.
countrymeisterAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.