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

定義

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

public:
 override long GetBytes(int i, long dataIndex, cli::array <System::Byte> ^ buffer, int bufferIndex, int length);
public:
 virtual long GetBytes(int i, long dataIndex, cli::array <System::Byte> ^ buffer, int bufferIndex, int length);
public override long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length);
public override long GetBytes (int i, long dataIndex, byte[]? buffer, int bufferIndex, int length);
public long GetBytes (int i, 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 (i As Integer, dataIndex As Long, buffer As Byte(), bufferIndex As Integer, length As Integer) As Long
Public Function GetBytes (i As Integer, dataIndex As Long, buffer As Byte(), bufferIndex As Integer, length As Integer) As Long

參數

i
Int32

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

dataIndex
Int64

欄位內讀取作業開始之處的索引。

buffer
Byte[]

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

bufferIndex
Int32

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

length
Int32

要讀取的位元組數。

傳回

讀取的實際位元組數目。

實作

備註

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

如果您傳遞的緩衝區是 Null 值, GetBytes 則會以位元組為單位傳回欄位的長度。

轉換是根據 ODBC 驅動程式的基礎功能來執行。 如果不支持轉換,則方法呼叫將會失敗。

注意

如果的值 bufferIndex 超出陣列,則不會擲回例外狀況。 不會讀取任何數據,而且方法會傳回 0。

適用於

另請參閱