Bug #97061 | MySqlCommand.LastInsertedId returns 0 after executing multiple statements | ||
---|---|---|---|
Submitted: | 30 Sep 2019 7:15 | Modified: | 28 Nov 2022 18:14 |
Reporter: | Niklas Föcking | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / NET | Severity: | S3 (Non-critical) |
Version: | 8.0.17 | OS: | Windows |
Assigned to: | CPU Architecture: | Any |
[30 Sep 2019 7:15]
Niklas Föcking
[30 Sep 2019 10:40]
MySQL Verification Team
Hello Niklas Föcking, Thank you for the report. regards, Umesh
[13 Dec 2019 7:32]
Cyborg Pro
Same bug MySqlCommand.LastInsertedId returned 0, if command contained more then one INSERT. Connector/NET(MySql.Data.dll) 8.0.18.0
[22 Sep 2022 22:43]
Omar Chavez
Posted by developer: Verified using Connector/Net version 8.0.30
[24 Nov 2022 18:11]
Daniel Valdez
Posted by developer: When executing multiple Insert statements in one single MySQLCommand, the LastInsertedId property was set to zero since Connector/NET was reading an extra OK packet from the server that doesn't contain the LastInsertedId. The fix was to avoid overriding the value of the LastInsertedId property if this has been already set.
[28 Nov 2022 18:14]
Christine Cole
Posted by developer: Fixed as of the upcoming MySQL Connector/NET 8.0.32 release, and here's the proposed changelog entry from the documentation team: When executing multiple Insert statements in one MySQLCommand call, the LastInsertedId property was set to zero because the connector read an extra OK packet from the server that omitted LastInsertedId. Now, Connector/NET avoids overriding the value if it is set Thank you for the bug report.