The following table lists the. NET Framework type, dbtype, sqldbtype enumeration, and sqldatareader accessors.
SQL Server database engine type |
. NET Framework type |
Sqldbtype Enumeration |
Sqldatareader sqltypes type accesser |
Dbtype Enumeration |
Sqldatareader dbtype type accessors |
Bigint |
Int64 |
Bigint |
Getsqlint64 |
Int64 |
Getint64 |
Binary |
Byte [] |
Varbinary |
Getsqlbinary |
Binary |
Getbytes |
Bit |
Boolean |
Bit |
Getsqlboolean |
Boolean |
Getboolean |
Char |
String |
Char |
Getsqlstring |
Ansistringfixedlength, |
Getstring |
Char [] |
String |
Getchars |
Date (SQL Server 2008 only) |
Datetime |
Date |
Getsqldatetime |
Date |
Getdatetime |
Datetime |
Datetime |
Datetime |
Getsqldatetime |
Datetime |
Getdatetime |
Datetime2 (SQL Server 2008 only) |
Datetime2 |
Datetime2 |
Getsqldatetime |
Datetime2 |
Getdatetime |
Datetimeoffset (SQL Server 2008 only) |
Datetimeoffset |
Datetimeoffset |
None |
Datetimeoffset |
Getdatetimeoffset |
Decimal |
Decimal |
Decimal |
Getsqldecimal |
Decimal |
Getdecimal |
Filestream attributes (varbinary (max) |
Byte [] |
Varbinary |
Getsqlbytes |
Binary |
Getbytes |
Float |
Double |
Float |
Getsqldouble |
Double |
Getdouble |
Image |
Byte [] |
Binary |
Getsqlbinary |
Binary |
Getbytes |
Int |
Int32 |
Int |
Getsqlint32 |
Int32 |
Getint32 |
Money |
Decimal |
Money |
Getsqlmoney |
Decimal |
Getdecimal |
Nchar |
String |
Nchar |
Getsqlstring |
Stringfixedlength |
Getstring |
Char [] |
Getchars |
Ntext |
String |
Ntext |
Getsqlstring |
String |
Getstring |
Char [] |
Getchars |
Numeric |
Decimal |
Decimal |
Getsqldecimal |
Decimal |
Getdecimal |
Nvarchar |
String |
Nvarchar |
Getsqlstring |
String |
Getstring |
Char [] |
Getchars |
Real |
Single |
Real |
Getsqlsingle |
Single |
Getfloat |
Rowversion |
Byte [] |
Timestamp |
Getsqlbinary |
Binary |
Getbytes |
Smalldatetime |
Datetime |
Datetime |
Getsqldatetime |
Datetime |
Getdatetime |
Smallint |
Int16 |
Smallint |
Getsqlint16 |
Int16 |
Getint16 |
Smallmoney |
Decimal |
Smallmoney |
Getsqldecimal |
Decimal |
Getdecimal |
SQL _variant |
Object * |
Variant |
Getsqlvalue * |
Object |
Getvalue * |
Text |
String |
Text |
Getsqlstring |
String |
Getstring |
Char [] |
Getchars |
Time (SQL Server 2008 only) |
Timespan |
Time |
None |
Time |
Getdatetime |
Timestamp |
Byte [] |
Timestamp |
Getsqlbinary |
Binary |
Getbytes |
Tinyint |
Byte |
Tinyint |
Getsqlbyte |
Byte |
Getbyte |
Uniqueidentifier |
Guid |
Uniqueidentifier |
Getsqlguid |
Guid |
Getguid |
Varbinary |
Byte [] |
Varbinary |
Getsqlbinary |
Binary |
Getbytes |
Varchar |
String |
Varchar |
Getsqlstring |
Ansistring, string |
Getstring |
Char [] |
Getchars |
XML |
XML |
XML |
Getsqlxml |
XML |
None |