DB2®Decimal Structure

Represents the DECIMAL Db2® data type. Encapsulates the decimal .NET data type if maxium precision is 29 digits, and the string data type if maximum precision is 31 digits.

Namespace:

DB2DataSourceEnumeratorClassGetDataSourcesMethod1.dita

DB2DataSourceEnumeratorClassGetDataSourcesMethod1.dita

IBM.Data.DB2Types
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax


[Visual Basic]
Public Structure DB2Decimal
[C#]
public struct DB2Decimal
[C++]
public value class DB2Decimal

Example

[C#] The following example demonstrates how to retrieve a single DECIMAL column value from a table.

[C#]
  public static string getParam(DB2Connection conn)
  {
    string mySelectQuery = "SELECT * FROM EMPLOYEE";
    DB2Command myCommand = new DB2Command(mySelectQuery, conn);
    DB2DataReader reader = myCommand.ExecuteReader();

    if (reader.Read())
    {
      DB2Decimal selectValue = reader.GetDB2Decimal(11);

      if (!selectValue.IsNull) { return selectValue.ToString(); }
    }

    return "NULL";
  }

Thread safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.