Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I retrieve a data type of tinyint from MySQL in C#?

Tags:

So in C# whenever I retrieved a tinyint from my MSSQL database I used the following cast.

(int)(byte)reader["MyField"];

However, that cast doesn't seem to work in MySQL.

What I have tried

(byte)reader["MyField"];

and just

(int)reader["MyField"];

Edit 1

Exception

The specified cast is not valid.

Edit 2

This is the data type.

{Name = "SByte" FullName = "System.SByte"}

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!