“Specified cast is not valid” error in C# windows forms program

前端 未结 9 1239
南方客
南方客 2020-12-10 13:20

I\'m having a \"Specified cast is not valid\" error. Windows form application in C#. I\'m trying to retrieve a value from a table. The value is either a smallint, or a numer

9条回答
  •  难免孤独
    2020-12-10 14:21

    Try using SqlDataReader's GetInt32()

    rdr.GetInt32(rdr.GetOrdinal("quantity"));
    

提交回复
热议问题