Bug #103312 MysqlHelper.executenonquery dont return affected rows correctly
Submitted: 13 Apr 21:50 Modified: 14 Apr 13:12
Reporter: mohamed atef Email Updates:
Status: Analyzing Impact on me:
Category:Connector / NET Severity:S3 (Non-critical)
Version:8.0.23 OS:Microsoft Windows
Assigned to: MySQL Verification Team CPU Architecture:Any
Tags: mysqlhelper.executenonquery

[13 Apr 21:50] mohamed atef
when using insert into table on duplicate key update 
mysqlhelper.executenonquery don`t return the affected rows correctly
in dotnet connector version 8.0.23

How to repeat:
open workbench
create table 
CREATE TABLE `testignore` (
  `Id` int(11) NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT  INTO `abc`.`testignore` (`Id`) VALUES ('1');
INSERT  INTO `abc`.`testignore` (`Id`) VALUES ('2');
SELECT * FROM abc.testignore;
2 row(s) returned;

INSERT  INTO `abc`.`testignore` (`Id`) VALUES ('1') on duplicate key update Id=Id;
0 row(s) affected;

INSERT  INTO `abc`.`testignore` (`Id`) VALUES ('2') on duplicate key update Id=Id;
0 row(s) affected;

create windows form application
add mysql.data dll as refernce

private void button1_Click(object sender, EventArgs e)
            string SQLADD = "INSERT  INTO `abc`.`testignore` (`Id`) VALUES (@P1) on duplicate key update Id=Id ;";
                int[] lst = new int[]
                foreach (int u in lst)
                    MySqlParameter[] PARA = new MySqlParameter[]
                        new MySqlParameter(){ ParameterName="P1",MySqlDbType=MySqlDbType.Int32,Value= u }
                    int i = MySqlHelper.ExecuteNonQuery(MyCurrentConnString(), SQLADD, PARA);
            catch(Exception ex)
        private string MyCurrentConnString()
            MySqlConnectionStringBuilder cons = new MySqlConnectionStringBuilder
                Server = "",
                Port = 3306,
                UserID = "root",
                Password = "yousef",
                Database = "abc",
                ConvertZeroDateTime = true,
                SslMode = MySqlSslMode.None,
                AllowUserVariables = true
            return cons.ToString();

every time i value will be shown as 1 although 0rows affected

Suggested fix:
i don`t know
[14 Apr 13:12] mohamed atef
Also return Invalid Affected Rows