I have an ancient Access97 database that contains astronomical data that I would like to use in a telescope's pointing software. The Hour and Minute of Right Ascension are stored as UnsignedTinyInt.
I am assuming UnsignedTinyInt is an unsigned short, or ushort. If I code the following, where "reader" is an OleDbDataReader and fld is the ordinal value. Int16 is the shortest integer available, apparently.
select myValue from myTable;
ushort myValue;
myValue = reader.GetInt16(fld);
The exact exception is Invalid Cast. There are a number of Get methods available in the OleDbDataReader, including three GetInts. No GetInt works, no matter how I declare myValue.
I was able to solve this with:
select myValue from myTable;
byte myValue;
myValue = reader.GetByte(fld);