| Bug #8657 | MySqlDataReader.RecordsAffected returns always 0 (zero) | ||
|---|---|---|---|
| Submitted: | 21 Feb 2005 19:15 | Modified: | 23 Feb 2005 14:51 |
| Reporter: | [ name withheld ] | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / NET | Severity: | S3 (Non-critical) |
| Version: | 1.0.4 | OS: | Windows (WinNT) |
| Assigned to: | Reggie Burnett | CPU Architecture: | Any |
[21 Feb 2005 19:24]
[ name withheld ]
Ooops, That is not a bug... Sorry, that value only changes when the table is modified by the query.
[23 Feb 2005 14:51]
Reggie Burnett
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.mysql.com/documentation/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php Additional info: I like these! :-)

Description: The RecordsAffected property of the MySql.Data.MySqlClient.MySqlDataReader object in the MySQL .net connector, always returns 0, no matter how many records affect the query. My specs: WinXP Pro SP2 .net Framework 2.0b Visual Studio 2005 Beta 1 MySQL Connector/Net 1.0.4 MySQL DB 4.1.1-alpha-nt How to repeat: Private Function getTableDataSQL(ByVal Table As String) As String Dim DR As MySql.Data.MySqlClient.MySqlDataReader Dim SQL As String Dim SB As New Text.StringBuilder Dim i, j As Integer SQL = "SELECT * FROM " & Table Comm.CommandText = SQL DR = Comm.ExecuteReader() DR.Read() If DR.RecordsAffected > 0 Then 'This always is 0 SB.AppendLine("Lines added: " & DR.RecordsAffected.ToString) Else SB.AppendLine("Lines added: 0") End If DR.Close() Return SB.ToString End Function Suggested fix: Use a "Do-While" loop to read the data from the DataReader instead of a "For" statement. Example: Do While DR.Read SB.Append(DR(0).ToString) Loop