OleDbDataReader.GetChars(Int32, Int64, Char[], Int32, Int32) 方法

定義

從指定的資料行位移將字元資料流讀取到緩衝區中,作為以指定緩衝區位移開頭的陣列。

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

參數

ordinal
Int32

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

dataIndex
Int64

要開始讀取作業之資料列中的索引。

buffer
Char[]

要複製資料的目的緩衝區。

bufferIndex
Int32

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

length
Int32

要讀取的字元數。

傳回

讀取的實際字元數目。

實作

備註

GetChars 會傳回欄位中可用的字元數。 在大部分情況下,這是欄位的確切長度。 但是,如果已使用 GetChars 從欄位取得字元數,則傳回的數字可能小於欄位的實際長度。 例如,當將大型數據結構讀取到緩衝區時 OleDbDataReader ,這可能是這種情況。 如需詳細資訊,請參閱 SequentialAccessCommandBehavior設定。

如果您傳遞的緩衝區為 nullGetChars 則會以字元傳回字段的長度。

不會執行任何轉換;因此,擷取的數據必須是字元陣列。

適用於

另請參閱