Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

OdbcType Enumeration

Specifies the data type of a field, property, for use in an OdbcParameter.

Namespace:  System.Data.Odbc
Assembly:  System.Data (in System.Data.dll)
public enum OdbcType
Member nameDescription
BigIntExact numeric value with precision 19 (if signed) or 20 (if unsigned) and scale 0 (signed: –2[63] <= n <= 2[63] – 1, unsigned:0 <= n <= 2[64] – 1) (SQL_BIGINT). This maps to Int64.
BinaryA stream of binary data (SQL_BINARY). This maps to an Array of type Byte.
BitSingle bit binary data (SQL_BIT). This maps to Boolean.
CharA fixed-length character string (SQL_CHAR). This maps to String.
DateDate data in the format yyyymmdd (SQL_TYPE_DATE). This maps to DateTime.
DateTimeDate data in the format yyyymmddhhmmss (SQL_TYPE_TIMESTAMP). This maps to DateTime.
DecimalSigned, exact, numeric value with a precision of at least p and scale s, where 1 <= p <= 15 and s <= p. The maximum precision is driver-specific (SQL_DECIMAL). This maps to Decimal.
DoubleSigned, approximate, numeric value with a binary precision 53 (zero or absolute value 10[–308] to 10[308]) (SQL_DOUBLE). This maps to Double.
ImageVariable length binary data. Maximum length is data source–dependent (SQL_LONGVARBINARY). This maps to an Array of type Byte.
IntExact numeric value with precision 10 and scale 0 (signed: –2[31] <= n <= 2[31] – 1, unsigned:0 <= n <= 2[32] – 1) (SQL_INTEGER). This maps to Int32.
NCharUnicode character string of fixed string length (SQL_WCHAR). This maps to String.
NTextUnicode variable-length character data. Maximum length is data source–dependent. (SQL_WLONGVARCHAR). This maps to String.
NumericSigned, exact, numeric value with a precision p and scale s, where 1 <= p <= 15, and s <= p (SQL_NUMERIC). This maps to Decimal.
NVarCharA variable-length stream of Unicode characters (SQL_WVARCHAR). This maps to String.
RealSigned, approximate, numeric value with a binary precision 24 (zero or absolute value 10[–38] to 10[38]).(SQL_REAL). This maps to Single.
SmallDateTimeData and time data in the format yyyymmddhhmmss (SQL_TYPE_TIMESTAMP). This maps to DateTime.
SmallIntExact numeric value with precision 5 and scale 0 (signed: –32,768 <= n <= 32,767, unsigned: 0 <= n <= 65,535) (SQL_SMALLINT). This maps to Int16.
TextVariable length character data. Maximum length is data source–dependent (SQL_LONGVARCHAR). This maps to String.
TimeDate data in the format hhmmss (SQL_TYPE_TIMES). This maps to DateTime.
TimestampA stream of binary data (SQL_BINARY). This maps to an Array of type Byte.
TinyIntExact numeric value with precision 3 and scale 0 (signed: –128 <= n <= 127, unsigned:0 <= n <= 255)(SQL_TINYINT). This maps to Byte.
UniqueIdentifierA fixed-length GUID (SQL_GUID). This maps to Guid.
VarBinaryVariable length binary. The maximum is set by the user (SQL_VARBINARY). This maps to an Array of type Byte.
VarCharA variable-length stream character string (SQL_CHAR). This maps to String.

The following table shows mappings between OdbcType data types, ODBC data types (shown in parentheses), and .NET Framework types.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.