因此,在 C# 中,每当我从我的 MSSQL 数据库中检索到 tinyint 时,我都会使用以下演员表。
(int)(byte)reader["MyField"];
但是,该演员表似乎在 MySQL 中不起作用。
我试过的
(byte)reader["MyField"];
并且只是
(int)reader["MyField"];
编辑 1
例外
The specified cast is not valid.
编辑 2
这是数据类型。
{Name = "SByte" FullName = "System.SByte"}