INFO: OleDbType Enumeration vs. Microsoft Access Data Types


This article describes how the Microsoft .NET Platform OLE DB types map to the Microsoft Access data types for columns.

More Information

When you use the Access interface to design a table, you see several choices for field types that do not match to database data types. This is because these "types" are just display formats and do not determine the data type. Access uses other properties that are not necessarily exposed through the Microsoft OLE DB Provider for Jet to determine how to format the data.

Examples of these properties include the following:
  • General Date, Long Date, Long Time, Medium Time, Short Time, Medium Date, and Short Date are display formats for DateTime data type.
  • Hyperlink is a display format for Access Text data type.
  • True/False and On/Off both map to the Access Yes/No data type.

List of the Most Common Data Type Mappings

The following table lists the most common data types that are used in Microsoft Access and how these data types relate to the Microsoft .NET Framework data types and to the OleDbType enumeration.

Access Type NameDatabase Data TypeOLE DB Type.NET Framework TypeMember Name
Number: ByteUnsignedTinyIntDBTYPE_UI1System.ByteOleDbType.UnsignedTinyInt
Number: DecimalDecimalDBTYPE_NUMERICSystem.DecimalOleDbType.Numeric
Number: DoubleDoubleDBTYPE_R8System.DoubleOleDbType.Double
Autonumber (Replication ID)GUIDDBTYPE_GUIDSystem.GuidOleDbType.Guid
Number: (Replication ID)GUIDDBTYPE_GUIDSystem.GuidOleDbType.Guid
Autonumber (Long Integer)IntegerDBTYPE_I4System.Int32OleDbType.Integer
Number: (Long Integer)IntegerDBTYPE_I4System.Int32OleDbType.Integer
OLE ObjectLongVarBinaryDBTYPE_BYTESArray of System.ByteOleDbType.LongVarBinary
Number: SingleSingleDBTYPE_R4System.SingleOleDbType.Single
Number: IntegerSmallIntDBTYPE_I2System.Int16OleDbType.SmallInt
BinaryVarBinary*DBTYPE_BYTESArray of System.ByteOleDbType.Binary

* This data type is not available in the Access designer user interface. You must create this data type through code.


For more information about data types, visit the following MSDN Web sites:

OLE DB Provider for Microsoft Jet: Data Type Support

OLE DB Provider for Microsoft Jet: Provider-Specific Properties in DBPROPSET_JETOLEDB_COLUMN

OleDbType Enumeration