I encountered a problem that I rarely encountered today. The record is as follows:
In the database, there is a stored procedure sp_createorupdatexxx that executes the insert or update (already exists) operation,
InProgramWhen SQL command. executenonquery () is executed, no affected rows are returned.
Check the stored procedure and find thatCodeThe first line has an additional SQL statement:Set nocount on;
After the code is deleted, the number of affected lines is returned.
MATERIALS:
WhenSet nocountIs OnNo count is returned (indicating the number of rows affected by the transct-SQL statement ).
If some statements contained in the stored procedure do not return a large amount of actual data, the setting can significantly improve the performance because it greatly reduces network traffic.
WhenSet nocountIs OffReturn count.
Even ifWhenSet nocountIs On,Also update the @ rowcount function.