DB2 Version 10.1 for Linux, UNIX, and Windows

DB2Binary Structure

Represents the BINARY, VARBINARY, CHAR FOR BIT DATA, VARCHAR FOR BIT DATA, and LONG VARCHAR FOR BIT DATA DB2® data types. Encapsulates the byte[ ] .NET data type.

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

Syntax

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

Example

[C#] The following example demonstrates how to retrieve a single FOR BIT DATA character string column value from a table.

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

    if (reader.Read())
    {
      DB2Binary selectValue = reader.GetDB2Binary(0);

      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.

Version information

Last update
This topic was last updated for: IBM DB2 Version 9.5
.NET Framework version
Supported in: 2.0, 3.0, 3.5, and 4.0
IBM Data Server Client
Supported in: IBM DB2 Version 9