467,116 Members | 1,155 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,116 developers. It's quick & easy.

"Connection is dead" on ODBC insert of decimal into DB2

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
Nov 12 '05 #1
  • viewed: 2020
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.