Bug #6770 MySqlDataReader.GetChar(int i) throws IndexOutOfRange Exception
Submitted: 23 Nov 2004 14:10 Modified: 30 Nov 2004 22:12
Reporter: Jean-Paul Malherbe Email Updates:
Status: Closed Impact on me:
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.2 OS:Windows (Windows XP)
Assigned to: Reggie Burnett CPU Architecture:Any

[23 Nov 2004 14:10] Jean-Paul Malherbe
public char GetChar(int i)
    string s = GetString(i);
    return s[i];

Getchar is usually used to return a single character from a column specified by ordinal i. If s.count < i, and index out of range exception will occur.

How to repeat:
Try to access a column with ordinal of 1 or more, that only contains a single character.

I think the problem is self explanatory.

Suggested fix:
public char GetChar(int i)
    string s = GetString(i);
    return s[0];
[30 Nov 2004 22:12] 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