when i implemented an update Functionality using asp.net.
I got a very strange return -1 in each execution. since I had a conditional check to verify each update.
As I know that sqlComm.ExecuteNonQuery() return the number of rows being affected by the Update, Insert operation.
when i went back to look at my Stored-Procedure i found that SET NOCOUNT ON; in my Stored Procedure.
Alter PROCEDURE [dbo].[Customer_Data_Master_Upd]
@Prospect nvarchar(10)
AS
BEGIN
SET NOCOUNT ON;
Update Customer_Data_Master
Set Status='N'
where LCDGCC =@Prospect
END
after I commented out the line Set NOCOUNT ON
My conditional check works as plan. In My opinion, the Set NOCOUNT On should only be enable in Select statment to improve performance.
No comments:
Post a Comment