The Ingres .NET Data Provider defines its own enumeration of supported data types in addition to the standard System.Data.DbType enumeration.
The following table shows the mapping of the Ingres .NET Data Provider's data types to its .NET data type counterparts. For information on the typed accessors that a .NET application uses for an Ingres native database type to be obtained as a .NET type, see IngresDataReader Class.
IngresType |
Ingres |
Description |
.NET Data Type |
---|---|---|---|
Binary |
byte |
Fixed length stream of binary data |
Byte[ ] |
Char |
char |
Fixed length stream of character data |
String |
DateTime |
date |
Date data |
DateTime |
Decimal |
decimal |
Exact numeric data |
Decimal |
Double |
double precision (float8) |
Approximate numeric data |
Double |
SmallInt |
smallint |
Signed 16-bit integer data |
Int16 |
TinyInt |
integer1 |
Signed 8-bit integer data |
SByte |
Int |
integer |
Signed 32-bit integer data |
Int32 |
BigInt |
bigint |
Signed 64-bit integer data |
Int64 |
LongVarBinary |
long byte |
Binary large object |
Byte[ ] |
LongVarChar |
long varchar |
Character large object |
String |
LongNVarChar |
long nvarchar |
Unicode large object |
String |
NChar |
nchar |
Fixed length stream of Unicode data |
String |
NVarChar |
nvarchar |
Variable length stream of Unicode data |
String |
Real |
real (float4) |
Approximate numeric data |
Single |
VarBinary |
byte varying |
Variable length stream of binary data |
Byte[ ] |
VarChar |
varchar |
Variable length stream of character data |
String |
Notes:
.NET's System.Data.DbType for a parameter is mapped to the IngresType data type as follows:
DbType |
IngresType |
---|---|
AnsiString |
VarChar |
AnsiStringFixedLength |
Char |
Binary |
VarBinary |
Boolean |
TinyInt, if supported by the database; otherwise, SmallInt |
Byte |
Binary, if supported by the database; otherwise, Char |
Currency |
Decimal |
Date |
DateTime |
DateTime |
DateTime |
Decimal |
Decimal |
Double |
Double |
Guid |
Not supported |
Int16 |
SmallInt |
Int32 |
Int |
Int64 |
Decimal |
Object |
Not supported |
SByte |
TinyInt, if supported by the database; otherwise, SmallInt |
Single |
Real |
String |
NVarChar , if supported by the database; otherwise, VarChar |
StringFixedLength |
NChar, if supported by the database; otherwise, Char |
Time |
DateTime |
UInt16 |
Int |
UInt32 |
Decimal |
UInt64 |
Decimal |
VarNumeric |
Decimal |
.NET strings are Unicode based. If the application is sending a Unicode string as a parameter to a database field that is ASCII char or varchar, the application can direct the data provider to coerce the Unicode string to an ASCII string on the client side by setting the IngresParameter's DbType property to DbType.AnsiString or the IngresType property to IngresType.VarChar.
The following is an example of coercing a Unicode string:
IngresCommand cmd = new IngresCommand(
"select name from personnel where ssn = ?",
conn);
IngresParameter parm =
new IngresParameter("SSN", IngresType.VarChar);
parm.Value = strSSN;
cmd.Parameters.Add(parm);