共用方式為


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

定義

取得資料行的值,其由該序數指定為 Char 物件陣列。

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

參數

ordinal
Int32

資料行以零為起始的序數。

fieldOffset
Int64

要開始擷取字元之欄位值的位移。

buffer
Char[]

複製字元的目標緩衝區。

bufferOffset
Int32

開始複製字元至緩衝區的位移。

length
Int32

要複製到緩衝區的字元數目。

傳回

已複製的字元數。

實作

例外狀況

ordinal 小於 0 或大於資料行數目 (亦即 FieldCount)。

ordinal 指定的資料行為 null。

類型不符。

備註

這個方法可讓您在單一呼叫或區塊中取得字元值。 以區塊取得值對於大型值或未知大小的值很有用。

若要取得數個區塊中的值,請配置區塊大小的 char 陣列,並在 GetChars 每次呼叫中重複調整 fieldOffset 參數。

適用於