skip to main content
Developing ADO.NET Applications : Data Types : Mapping Parameter Data Types
 

Mapping Parameter Data Types

The type of the parameter is specific to each data provider. The .NET Client must convert the parameter value to a native format before sending it to the server. The best way for an application to describe a parameter is to use the data provider-specific type enumeration.
In generic programming circumstances, the data provider-specific type may not be available. When no provider-specific DbType has been specified, the data type will be inferred from either the System.Data.DbType or from the .NET Framework type of the parameter’s value.
The .NET Client uses the following order when inferring the data type of a parameter:
The .NET Client uses the provider-specific data type if it has been specified.
The .NET Client infers the data type from the System.Data.DbType if it has been specified, but the provider-specific data type has not been specified.
The .NET Client infers the data type from the .NET Framework type if neither the provider-specific data type nor the System.Data.DbType have been specified.
The following table shows how OpenAccess SDK infers its types if only the System.Data.DbType is specified.
 
Table 30: Mapping of the System.Data.DbTypes to OpenAccessDbTypes  
System.Data.DbType
OpenAccessDbType
AnsiString
VarChar
AnsiStringFixedLength
Char
Binary
VarBinary
Boolean
Bit
Byte
Byte
Currency
Decimal
Date
Date
DateTime
TimeStamp
Decimal
Decimal
Double
Double
Guid
Not supported
Int16
SmallInt
Int32
Int
Int64
Not supported
Object
Not supported
Sbyte
Byte
Single
Single
String
VarChar
StringFixedLength
Char
Time
Time
Uint16
Int
Uint32
Decimal
Uint64
Decimal
VarNumeric
Not supported
The following table shows the mapping that the .NET Client uses to infer a data type if neither the provider-specific data type or the System.Data.DbType are provided.
 
Table 31: Mapping .NET Framework Data Types to OpenAccessDbTypes  
.NET Framework Type
OpenAccessDbType
Boolean
Bit
Byte
Byte
Byte[]
Varbinary
Char, Char[]
Not supported
DateTime
TimeStamp
Decimal
Decimal
Double
Double
Guid
Not supported
Int16
SmallInt
Int32
Int
Int64
Not supported
Object
Not supported
Single
Single
String
VarChar
Timespan
Time
Uint16
Int
Uint32
Decimal
Uint64
Decimal