Bug #7755 MySqlReader.GetInt32 throws exception if column is unsigned
Submitted: 10 Jan 2005 4:44 Modified: 12 Jan 2005 17:27
Reporter: Kris Kimbrough Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.3 OS:Windows (Win/XP)
Assigned to: Reggie Burnett CPU Architecture:Any

[10 Jan 2005 4:44] Kris Kimbrough
Description:

Reading a column value using GetInt32 throws an exception if the column is defined as unsigned.  

"Specified cast is not valid."

In the example I was testing the value in the column was 2, so not sure why GetInt32 couldn't cast a 2 into an int32 without an exception?  I know other .Net data providers handle this scenario correctly.

How to repeat:
define an int(6) unsigned column and attempt to read it:

MySqlDataReader reader ;
...
int pkValue = (int) reader.GetInt32 (0) ;
[12 Jan 2005 17:27] 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

Additional info:

I've known about this for sometime.  I wasn't sure I wasn't even going to do anything about it since the SQL Server provider doesn't allow you to silently convert types like this.  However CoreLabs does allow it and so I have made the change.