Rediger

Del via


ODBC Data Type Mappings

The following table shows the inferred .NET Framework type for data types from the .NET Framework Data Provider for ODBC (System.Data.Odbc). The typed accessor methods for the OdbcDataReader are also listed.

ODBC type .NET Framework type .NET Framework typed accessor
SQL_BIGINT Int64 GetInt64()
SQL_BINARY Byte[] GetBytes()
SQL_BIT Boolean GetBoolean()
SQL_CHAR String

Char[]
GetString()

GetChars()
SQL_DECIMAL Decimal GetDecimal()
SQL_DOUBLE Double GetDouble()
SQL_GUID Guid GetGuid()
SQL_INTEGER Int32 GetInt32()
SQL_LONG_VARCHAR String

Char[]
GetString()

GetChars()
SQL_LONGVARBINARY Byte[] GetBytes()
SQL_NUMERIC Decimal GetDecimal()
SQL_REAL Single GetFloat()
SQL_SMALLINT Int16 GetInt16()
SQL_TINYINT Byte GetByte()
SQL_TYPE_TIMES DateTime GetDateTime()
SQL_TYPE_TIMESTAMP DateTime GetDateTime()
SQL_VARBINARY Byte[] GetBytes()
SQL_WCHAR String

Char[]
GetString()

GetChars()
SQL_WLONGVARCHAR String

Char[]
GetString()

GetChars()
SQL_WVARCHAR String

Char[]
GetString()

GetChars()

See also