Reads a stream of bytes from the specified column offset into the buffer as an array, starting at the given buffer offset.
[Visual Basic]
Public Function GetBytes( _
ByVal i As Integer, _
ByVal dataIndex As Long, _
ByVal buffer() As Byte, _
ByVal bufferIndex As Integer, _
ByVal length As Integer _
) As Long
[C#]
public long GetBytes(
int i,
long dataIndex,
byte[] buffer,
int bufferIndex,
int length
);
[C++]
public: __int64 GetBytes(
int i,
__int64 dataIndex,
unsigned char buffer __gc[],
int bufferIndex,
int length
);
[JScript]
public function GetBytes(
i : int,
dataIndex : long,
buffer : Byte[],
bufferIndex : int,
length : int
) : long;
The actual number of bytes read.
| Exception type | Condition |
|---|---|
| DB2Exception | Invalid conversion. |
GetBytes returns the number of available bytes in the field. In most cases this is the exact length of the field. However, the number returned may be less than the true length of the field if GetBytes has already been used to obtain bytes from the field. This may be the case, for example, if the DB2DataReader is reading a BLOB into a buffer. For more information, see the SequentialAccess setting of System.Data.CommandBehavior in the Microsoft(R) .NET Framework SDK documentation.
If you pass a buffer that is a null value, GetBytes returns the length of the field in bytes.
| DB2Type Data Type | DB2 Data Type | Informix® Data Type |
|---|---|---|
| Xml | XML | |
| Binary | BINARY, CHAR FOR BIT DATA | |
| VarBinary | VARBINARY | |
| LongVarBinary | LONG VARCHAR FOR BIT DATA | |
| Blob | BLOB | BLOB, BYTE |