ExecuteNonQuery returns 0

ExecuteNonQuery returns 0

Postby alejandro_aries » Tue 27 Jun 2017 15:57

In our software company, we bought mysql devart connector to replace the mysql.data original connector for our software application which creates large transactions through {Devart.Data.MySql.MySqlCommand} sending 'updates' and 'insert' commands. Mysql.Data connector returns 1 if there is 1 row matched even if it there are 0 rows changed.
On the other hand, Devart.Data.Mysql connector returns 0 if there are 0 rows changed even if there is 1 row matched as the image attached below.

I cannot change the source code of my software application, and I would like to know how to retrieve the rows matched and the rows changed according to the Devart.Data.MySql.MysqlCommand class, but I haven´t been able to achieve it due protection level.
How do you think I could do that ?

Thank you very much.

Posts: 1
Joined: Tue 27 Jun 2017 15:36

Re: ExecuteNonQuery returns 0

Postby Pinturiccio » Fri 30 Jun 2017 15:48

The ExecuteNonQuery method of MySqlCommand class returns the number of affected records for UPDATE, INSERT, and DELETE statements. For all other types of statements, including stored procedures, the return value is '-1'. For more information, please refer to https://www.devart.com/dotconnect/mysql/docs/?Devart.Data~Devart.Common.DbCommandBase~ExecuteNonQuery.html

The number of matched rows is not returning by MySqlCommand.
Devart Team
Posts: 1925
Joined: Wed 02 Nov 2011 09:44

Return to dotConnect for MySQL