I am reading a row from a SQL Server table. One of the columns is of type tinyint.
I want to get the value into an int or int32 variable.
rdr.GetByte(j)
(byte) rdr.GetValue(j)
…seems to be the only way to retrieve the value. But how do I get the result into an int variable?
int value = rdr.GetByte(j);An explicit cast is not required, because a
bytetointis a widening conversion (no possibility of data loss).