I have a program that is running an UPDATE query. For testing purposes, the query is fixed, just UPDATE table SET field = 'field_name' WHERE other_field = 'id_field_value'
. I'm using a MySqlCommand
and executing the query with sqlCommand.ExecuteNonQuery()
. However, I am running it over and over and it keeps on returning 1 row change each time. Running the same query in MySQL GUI tools returns 0 rows affected, as expected. What's the best way to figure out what changes are occurring to the sql db?
My question has been flagged as a duplicate-I am not asking how to get # rows affected by a sql query. I am asking how to find out what changes were made to a sql table when a query keeps on returning 1 row affected when I expect it to return 0.
NEVERMIND, my question was answered in the comments of the duplicate question (Get affected rows on ExecuteNonQuery). Turns out ExecuteNonQuery() doesn't return the number of rows that were actually modified, just the 'possible' number of rows that could've been modified. This is frankly much less useful.