GetBytes メソッド

指定した列オフセットからのバイト ストリームを、配列としてバッファに読み込みます。読み込みは、指定したバッファ オフセットから開始されます。

名前空間:  System.Data.SqlServerCe
アセンブリ:  System.Data.SqlServerCe (System.Data.SqlServerCe.dll)

構文

'宣言
Public Overrides Function GetBytes ( _
    ordinal As Integer, _
    dataIndex As Long, _
    buffer As Byte(), _
    bufferIndex As Integer, _
    length As Integer _
) As Long
'使用
Dim instance As SqlCeDataReader
Dim ordinal As Integer
Dim dataIndex As Long
Dim buffer As Byte()
Dim bufferIndex As Integer
Dim length As Integer
Dim returnValue As Long

returnValue = instance.GetBytes(ordinal, _
    dataIndex, buffer, bufferIndex, length)
public override long GetBytes(
    int ordinal,
    long dataIndex,
    byte[] buffer,
    int bufferIndex,
    int length
)
public:
virtual long long GetBytes(
    int ordinal, 
    long long dataIndex, 
    array<unsigned char>^ buffer, 
    int bufferIndex, 
    int length
) override
abstract GetBytes : 
        ordinal:int * 
        dataIndex:int64 * 
        buffer:byte[] * 
        bufferIndex:int * 
        length:int -> int64 
override GetBytes : 
        ordinal:int * 
        dataIndex:int64 * 
        buffer:byte[] * 
        bufferIndex:int * 
        length:int -> int64 
public override function GetBytes(
    ordinal : int, 
    dataIndex : long, 
    buffer : byte[], 
    bufferIndex : int, 
    length : int
) : long

パラメーター

  • dataIndex
    型: System. . :: . .Int64
    読み取り操作の開始位置を示す、フィールド内のインデックス。
  • buffer
    型: array<System. . :: . .Byte> [] () [] []
    バイト ストリームの読み取り先のバッファ。
  • bufferIndex
    型: System. . :: . .Int32
    読み取り操作を開始するための、buffer のインデックス。

戻り値

型: System. . :: . .Int64
実際に読み取ったバイト数。

実装

IDataRecord. . :: . .GetBytes(Int32, Int64, array<Byte> [] () [] [], Int32, Int32)

例外

例外 条件
InvalidOperationException

操作が有効ではありません。SqlCeDataReader が、結果セットの最後の行よりも後に置かれている可能性があります。

説明

GetBytes は、フィールド内の利用可能なバイト数を返します。ほとんどの場合、これは正確なフィールド長です。ただし、既に GetBytes を使用してフィールドからバイトを取得している場合は、返されるバイト数が、フィールドの実際の長さよりも小さくなることがあります。これは、SqlCeDataReader が、大きいデータ構造体をバッファに読み込んでいるときなどに起こります。詳細については、CommandBehavior の SequentialAccess 設定のトピックを参照してください。

null Nothing nullptr unit NULL 参照 (Visual Basic では Nothing) のバッファを渡すと、GetBytes は、バイト単位のフィールド長を返します。

変換は実行されません。そのため、取得するデータはバイト配列である必要があります。

関連項目

参照

SqlCeDataReader クラス

SqlCeDataReader メンバー

System.Data.SqlServerCe 名前空間