Link to home
Start Free TrialLog in
Avatar of mbowles
mbowles

asked on

ExecuteNonQuery return wrong value .NET 2.0

I have a stored procedure that deletes a single record (based on unique id)  When I run this from query analyzer it returns the out param as 1.   When I call this from .NET ExecuteNonQuery(cmd) it return a 19 which by definition is 19 records affected.  I have verified things by putting a new, single record in and deleting it via sql analyzer, then entering a single record and trying to delete it from ExecuteNonQuery.  It deletes but the return value is wrong and causes the rest of the app (which is expecint a 1) to cough.  Thougts?
ASKER CERTIFIED SOLUTION
Avatar of McExp
McExp
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of mbowles
mbowles

ASKER

Turns out when I looked at the teamates sp it was usinga  return param value that needed to be capture and not a row affected count.  Switched to executescalar and all is well!