INFO: OleDbType Enumeration vs. Microsoft Access Data Types

Article translations Article translations
Article ID: 320435 - View products that this article applies to.
This article was previously published under Q320435
Expand all | Collapse all

On This Page

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.

Collapse this tableExpand this table
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:
OLE DB Provider for Microsoft Jet: Data Type Support
http://msdn.microsoft.com/en-us/library/ms681754(VS.85).aspx

OLE DB Provider for Microsoft Jet: Provider-Specific Properties in DBPROPSET_JETOLEDB_COLUMN
http://msdn.microsoft.com/en-us/library/ms717947(VS.85).aspx

OleDbType Enumeration
http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbtype.aspx

Properties

Article ID: 320435 - Last Review: February 22, 2007 - Revision: 4.5
APPLIES TO
  • Microsoft ADO.NET 1.0
  • Microsoft ADO.NET 1.1
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2003 Professional Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Academic Edition
  • Microsoft Visual Studio .NET 2003 Academic Edition
Keywords: 
kbinfo KB320435

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com