ExecuteNonQuery returns double count

If I run the following in VB.NET the return value of the record count is double the actual update in SQL Server.

cmd.CommandText = "update documents set IsVerified = 1 where  IsVerified= 0"
Dim ret As Integer = cmd.ExecuteNonQuery

The value of ret is double the actual records updated.

Additional Information.

In SQL Server when I run the update query the return messages are as follows.

(9 row(s) affected)

(9 row(s) affected)

It appears that the ExecuteNonQuery is returning the added value of Rows Affected reported by SQL Server.

If I run the select statement of records meeting the conditions I get 9 rows.
LVL 1
dboteAsked:
Who is Participating?
 
Paul JacksonConnect With a Mentor Software EngineerCommented:
Do you have any triggers on the table as the return value will include any rows updated by the trigger as well as the initial update
0
 
dboteAuthor Commented:
Yes, actually that is exactly the case.

It is not my database so I was not thinking about triggers.  It makes perfect sense though.

Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.