A type map is used primarily for informative purposes, so that the developer can easily determine the .NET data type of a column in a database table.
The indexer for this class is settable, i.e., the developer can change the .NET data type to which a given database-specific type is mapped. This feature exists only to support complex development scenarios, and is intended to be used carefully and only in situations where a straightforward conversion between types is possible.
For example, a developer might want to remap a data type that is not CLS-compliant (such as an unsigned short integer) to a type that is, and is certain that data will not be corrupted by the conversion process.
The following table lists the default type conversion for each OleDbType constant:
OleDbType | .NET Type |
---|---|
Empty | DBNull |
SmallInt | Int16 |
Integer | Int32 |
Single | Single |
Double | Double |
Currency | Decimal |
Date | DateTime |
BSTR | String |
IDispatch | Object |
Error | Exception |
Boolean | Boolean |
Variant | Object |
IUnknown | Object |
Decimal | Decimal |
TinyInt | SByte |
UnsignedTinyInt | Byte |
UnsignedSmallInt | UInt16 |
UnsignedInt | UInt32 |
BigInt | Int64 |
UnsignedBigInt | UInt64 |
Filetime | DateTime |
Guid | Guid |
Binary | Byte[] |
Char | String |
WChar | String |
Numeric | Decimal |
DBDate | DateTime |
DBTime | TimeSpan |
DBTimeStamp | DateTime |
PropVariant | Object |
VarNumeric | Decimal |
VarChar | String |
LongVarChar | String |
VarWChar | String |
LongVarWChar | String |
VarBinary | Byte |
LongVarBinary | Byte[] |
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2