我收到一个报错:无法将类型为'System.Int64'的对象强制转换为类型'System.Int32'
,出现在以下位置:
item.ItemCount = reader.GetInt32(reader.GetOrdinal("amount"));
我尝试过:
item.ItemCount = reader.GetInt64(reader.GetOrdinal("amount"));
但我得到了:
Error CS0266
Cannot implicitly convert type 'long' to 'int'.
An explicit conversion exists (are you missing a cast?)
这个字段是 bigint
类型,这是我第一次使用 .Net。
ItemCount
属性修改为 long 类型。 - User2585