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

定義

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

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

參數

i
Int32

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

dataIndex
Int64

資料列內讀取作業開始之處的索引。

buffer
Char[]

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

bufferIndex
Int32

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

length
Int32

要讀取的字元數。

傳回

讀取的實際字元數目。

實作

備註

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

如果您傳遞的緩衝區是 Null 值, GetChars 則會以字元傳回字段的長度。

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

注意

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

適用於

另請參閱