Friday, November 9, 2012

MySqlDataReader reading tinyint (byte) as bool

Regrettably, work has forced me to work with MySql as I have been working in a LAMP enviorment instead of my beloved .net. However, if I make a utility I go right back to C#.

While making a little utillity that interface with MySql I used the MySQL Connector Net 6.1.6 library and the included MySqlDataReader. It has a very strange behavior where it thinks tinyints are bool. It took me about a day to track this down.

reader.ReadByte to the rescue.