OleDbDataReader.GetBytes(Int32, Int64, Byte[], Int32, Int32) 方法

定義

從指定的資料行位移將位元組資料流讀入做為陣列的緩衝區,開始於指定的緩衝區位移。

public:
 override long GetBytes(int ordinal, long dataIndex, cli::array <System::Byte> ^ buffer, int bufferIndex, int length);
public:
 virtual long GetBytes(int ordinal, long dataIndex, cli::array <System::Byte> ^ buffer, int bufferIndex, int length);
public override long GetBytes (int ordinal, long dataIndex, byte[] buffer, int bufferIndex, int length);
public override long GetBytes (int ordinal, long dataIndex, byte[]? buffer, int bufferIndex, int length);
public long GetBytes (int ordinal, long dataIndex, byte[] buffer, int bufferIndex, int length);
override this.GetBytes : int * int64 * byte[] * int * int -> int64
abstract member GetBytes : int * int64 * byte[] * int * int -> int64
override this.GetBytes : int * int64 * byte[] * int * int -> int64
Public Overrides Function GetBytes (ordinal As Integer, dataIndex As Long, buffer As Byte(), bufferIndex As Integer, length As Integer) As Long
Public Function GetBytes (ordinal As Integer, dataIndex As Long, buffer As Byte(), bufferIndex As Integer, length As Integer) As Long

參數

ordinal
Int32

以零為基底的資料行序數。

dataIndex
Int64

要開始讀取作業之欄位中的索引。

buffer
Byte[]

要將位元組資料流讀取到其中的緩衝區。

bufferIndex
Int32

buffer 內寫入作業開始之處的索引。

length
Int32

複製入緩衝區的最大長度。

傳回

讀取的實際位元組數目。

實作

備註

GetBytes 會傳回欄位中可用的位元組數目。 在大部分情況下,這是欄位的確切長度。 不過,如果 GetBytes 已經用來從欄位元組取得位元組,傳回的數位可能小於欄位的 true 長度。 例如,當將大型數據結構讀入緩衝區時 OleDbDataReader ,這可能是這種情況。 如需詳細資訊,請參閱 SequentialAccessCommandBehavior設定。

如果您傳遞的緩衝區為 nullGetBytes 則會傳回以位元組為單位的欄位長度。

不會執行轉換;因此,擷取的數據必須已經是位元組陣列。

適用於

另請參閱