Databases Reference
In-Depth Information
SQL Server Data Types
.NET Type
.NET Typed Accessor
nvarchar
String
or
Char[]
GetString
or
GetChars
real
Single
GetFloat
smalldatetime
DateTime
GetDateTime
smallint
Int16
GetInt16
smallmoney
Decimal
GetDecimal
sql_variant
Object
GetValue
long varchar
String
or
Char[]
GetString
or
GetChars
timestamp
Byte[]
GetBytes
tinyint
Byte
GetByte
uniqueidentifier
Guid
GetGuid
varbinary
Byte[]
GetBytes
varchar
String
or
Char[]
GetString
or
GetChars
Here are some available OLE DB data types, their corresponding .NET types, and
their .NET typed accessors (see Table 12-2).
Table 12-2.
OLE DB Typed Accessors
OLE DB Type
.NET Type
.NET Typed Accessor
DBTYPE_I8
Int64
GetInt64
DBTYPE_BYTES
Byte[]
GetBytes
DBTYPE_BOOL
Boolean
GetBoolean
DBTYPE_BSTR
String
GetString
DBTYPE_STR
String
GetString
DBTYPE_CY
Decimal
GetDecimal
DBTYPE_DATE
DateTime
GetDateTime
DBTYPE_DBDATE
DateTime
GetDateTime
DBTYPE_DBTIME
DateTime
GetDateTime
DBTYPE_DBTIMESTAMP
DateTime
GetDateTime
DBTYPE_DECIMAL
Decimal
GetDecimal
DBTYPE_R8
Double
GetDouble
DBTYPE_ERROR
ExternalException
GetValue
Continued
Search WWH ::
Custom Search