Bug #7612 MySqlDataReader.GetString(index) returns non-Null value when field is Null
Submitted: 2 Jan 2005 4:19 Modified: 5 Jan 2005 18:38
Reporter: Steven Toth Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.3-gamma OS:Windows (Windows XP)
Assigned to: Reggie Burnett CPU Architecture:Any

[2 Jan 2005 4:19] Steven Toth
Description:
MySqlDataReader.GetString(index) returns non-Null value when the field is Null.  I have a resultset being generated from a SELECT statement that returns a String field that is defined as NULLABLE.  Row 3 in the resultset has a non-NULL value in the field.  Every consectutive row in the resultset after row 3 that has a NULL value for the field in the database returns the non-NULL value (from row 3) instead of a NULL.  The IsDBNull method correctly returns TRUE for the fields that should be NULL even though the GetString method returns a non-NULL value.  The SELECT statement generates the correct output when run from the MySql Command Line Client.

How to repeat:
Generate a resultset from a table with a NULLABLE VARCHAR column with a row with a non-NULL value and a subsequent row with a NULL value.  The MySqlDataReader.GetString will return the non-NULL value for NULL value row.

Suggested fix:
Have the GetString return a NULL value.
[5 Jan 2005 18:38] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html