I am using ADO.net to call stored procedures to perform insertions into a Sybase database, and I want to include unit tests to ensure that the insert calls are working correctly.
According to the spec:
IDbCommand.ExecuteNonQuery()
Returns: The number of rows affected.
As each stored procedure is inserting one row, I am checking that the value returned == 1.
However, each procedure returns a different value, ranging from 3 to 8.
So, what exactly does the phrase ‘The number of rows affected’ mean?
I should sepcify that the only statements in the procs are Set, Insert, Print and Return, and the only statement that doesn’t seem to affect the return value is Insert!
Thanks.
According to MSDN the return value of ‘ExecuteNonQuery’ is not relevant for stored procedure execution.
You can instead use stored procedure return values or output parameters to obtain the desired value.