I am having problems inserting Decimal values into a DB2 database via
a .NET/C# application which is using an OdbcDataAdapter. Other field
types such as VarChar, Int, Date, etc work ok, and I can insert
literal values into a decimal field, but any attempt to insert a
decimal field via an OdbcParameter causes a
System.InvalidOperationException ("The connection is dead") to be
thrown by the DbDataAdapter.Update method.
The ODBC driver is IBM's DB2 Connect Personal Edition, Version 5
(installed as part of IBM DB2 Universal Database for Windows NT,
Version 5).
A typical failing OdbcParameter follows:
this.odbcInsertCommand1.Parameters.Add(
new System.Data.Odbc.OdbcParameter(
"API_GRAVITY",
System.Data.Odbc.OdbcType.Decimal,
0,
System.Data.ParameterDirection.Input,
false,
((System.Byte)(4)),
((System.Byte)(1)),
"API_GRAVITY",
System.Data.DataRowVersion.Current, null));
The database field is defined as DECIMAL 4 in the DB2 database.
Has anyone come across this before? Any suggestions for fixes or
workarounds?
Many thanks in advance,
John
Posted to: microsoft.public.dotnet.framework.odbcnet +
comp.databases.ibm-db2