I have a tinyint
column in the database and I wish to convert it to Int32
for an SqlDataReader
.
How do i go about it?
Edit #1
I recently had to do this.
int a = dataReader.GetByte(dr.GetOrdinal("ColumnName"));
#In Addition to Answer
SQL Server Data Type Mappings
bigint - GetInt64
binary - GetBytes
int - GetInt32
money - GetDecimal
rowversion - GetBytes
smallint - GetInt16
tinyint - GetByte
uniqueidentifier - GetGuid
...
For more info visit - SQL Server Data Type Mappings