OLE DB Data Type Mappings

 

The following table shows the inferred .NET Framework type for data types from the .NET Framework Data Provider for ADO and OLE DB (System.Data.OleDb). The typed accessor methods for the OleDbDataReader are also listed.

ADO typeOLE DB type.NET Framework type.NET Framework typed accessor
adBigIntDBTYPE_I8Int64GetInt64()
adBinaryDBTYPE_BYTESByte[]GetBytes()
adBooleanDBTYPE_BOOLBooleanGetBoolean()
adBSTRDBTYPE_BSTRStringGetString()
adChapterDBTYPE_HCHAPTERSupported through the DataReader. See Retrieving Data Using a DataReader.GetValue()
adCharDBTYPE_STRStringGetString()
adCurrencyDBTYPE_CYDecimalGetDecimal()
adDateDBTYPE_DATEDateTimeGetDateTime()
adDBDateDBTYPE_DBDATEDateTimeGetDateTime()
adDBTimeDBTYPE_DBTIMEDateTimeGetDateTime()
adDBTimeStampDBTYPE_DBTIMESTAMPDateTimeGetDateTime()
adDecimalDBTYPE_DECIMALDecimalGetDecimal()
adDoubleDBTYPE_R8DoubleGetDouble()
adErrorDBTYPE_ERRORExternalExceptionGetValue()
adFileTimeDBTYPE_FILETIMEDateTimeGetDateTime()
adGUIDDBTYPE_GUIDGuidGetGuid()
adIDispatchDBTYPE_IDISPATCH *ObjectGetValue()
adIntegerDBTYPE_I4Int32GetInt32()
adIUnknownDBTYPE_IUNKNOWN *ObjectGetValue()
adNumericDBTYPE_NUMERICDecimalGetDecimal()
adPropVariantDBTYPE_PROPVARIANTObjectGetValue()
adSingleDBTYPE_R4SingleGetFloat()
adSmallIntDBTYPE_I2Int16GetInt16()
adTinyIntDBTYPE_I1ByteGetByte()
adUnsignedBigIntDBTYPE_UI8UInt64GetValue()
adUnsignedIntDBTYPE_UI4UInt32GetValue()
adUnsignedSmallIntDBTYPE_UI2UInt16GetValue()
adUnsignedTinyIntDBTYPE_UI1ByteGetByte()
adVariantDBTYPE_VARIANTObjectGetValue()
adWCharDBTYPE_WSTRStringGetString()
adUserDefinedDBTYPE_UDTnot supported
adVarNumericDBTYPE_VARNUMERICnot supported

* For the OLE DB types DBTYPE_IUNKNOWN and DBTYPE_IDISPATCH, the object reference is a marshaled representation of the pointer.

Retrieving and Modifying Data in ADO.NET
ADO.NET Managed Providers and DataSet Developer Center

Show: