INFO: OleDbType Enumeration vs. Microsoft Access Data Types (320435)



The information in this article applies to:

  • Microsoft ADO.NET (included with the .NET Framework) 1.0
  • Microsoft ADO.NET (included with the .NET Framework 1.1)
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition

This article was previously published under Q320435

SUMMARY

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
TextVarWCharDBTYPE_WSTRSystem.StringOleDbType.VarWChar
MemoLongVarWCharDBTYPE_WSTRSystem.StringOleDbType.LongVarWChar
Number: ByteUnsignedTinyIntDBTYPE_UI1System.ByteOleDbType.UnsignedTinyInt
Yes/NoBooleanDBTYPE_BOOLSystem.BooleanOleDbType.Boolean
Date/TimeDateTimeDBTYPE_DATESystem.DateTimeOleDbType.Date
CurrencyDecimalDBTYPE_NUMERICSystem.DecimalOleDbType.Numeric
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
HyperlinkVarWCharDBTYPE_WSTRSystem.StringOleDbType.VarWChar

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

REFERENCES

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

Modification Type:MajorLast Reviewed:6/16/2004
Keywords:kbinfo KB320435