次の方法で共有


SqlCeDataReader.GetChars メソッド

指定した列オフセットからの文字ストリームを、配列としてバッファーに読み込みます。読み込みは、指定したバッファー オフセットから開始されます。

名前空間:  System.Data.SqlServerCe
アセンブリ:  System.Data.SqlServerCe (System.Data.SqlServerCe.dll)

構文

'宣言
<SecurityTreatAsSafeAttribute> _
<SecurityCriticalAttribute> _
Public Overrides Function GetChars ( _
    ordinal As Integer, _
    dataIndex As Long, _
    buffer As Char(), _
    bufferIndex As Integer, _
    length As Integer _
) As Long
'使用
Dim instance As SqlCeDataReader
Dim ordinal As Integer
Dim dataIndex As Long
Dim buffer As Char()
Dim bufferIndex As Integer
Dim length As Integer
Dim returnValue As Long

returnValue = instance.GetChars(ordinal, _
    dataIndex, buffer, bufferIndex, length)
[SecurityTreatAsSafeAttribute]
[SecurityCriticalAttribute]
public override long GetChars(
    int ordinal,
    long dataIndex,
    char[] buffer,
    int bufferIndex,
    int length
)
[SecurityTreatAsSafeAttribute]
[SecurityCriticalAttribute]
public:
virtual long long GetChars(
    int ordinal, 
    long long dataIndex, 
    array<wchar_t>^ buffer, 
    int bufferIndex, 
    int length
) override
[<SecurityTreatAsSafeAttribute>]
[<SecurityCriticalAttribute>]
abstract GetChars : 
        ordinal:int * 
        dataIndex:int64 * 
        buffer:char[] * 
        bufferIndex:int * 
        length:int -> int64 
[<SecurityTreatAsSafeAttribute>]
[<SecurityCriticalAttribute>]
override GetChars : 
        ordinal:int * 
        dataIndex:int64 * 
        buffer:char[] * 
        bufferIndex:int * 
        length:int -> int64 
public override function GetChars(
    ordinal : int, 
    dataIndex : long, 
    buffer : char[], 
    bufferIndex : int, 
    length : int
) : long

パラメーター

  • ordinal
    型: System.Int32
    列の 0 から始まる序数。
  • dataIndex
    型: System.Int64
    読み取り操作の開始位置を示す、行内のインデックス。
  • buffer
    型: array<System.Char[]
    データのコピー先のバッファー。
  • bufferIndex
    型: System.Int32
    読み取り操作を開始するための、buffer のインデックス。

戻り値

型: System.Int64
実際に読み取った文字数。

実装

IDataRecord.GetChars(Int32, Int64, array<Char[], Int32, Int32)

例外

例外 条件
InvalidOperationException

操作が有効ではありません。SqlCeDataReader が、結果セットの最後の行よりも後に置かれている可能性があります。

説明

GetChars は、フィールド内で利用可能な文字数を返します。ほとんどの場合、これは正確なフィールド長です。ただし、既に GetChars を使用してフィールドから文字を取得している場合は、返される文字数が、フィールドの実際の長さよりも小さくなることがあります。これは、SqlCeDataReader が、大きいデータ構造体をバッファーに読み込んでいるときなどに起こります。詳細については、CommandBehavior の SequentialAccess 設定のトピックを参照してください。

nullNULL 参照 (Visual Basic では Nothing) のバッファーを渡すと、GetChars は、文字単位のフィールド長を返します。

変換は実行されません。そのため、取得するデータは文字配列である必要があります。

関連項目

参照

SqlCeDataReader クラス

System.Data.SqlServerCe 名前空間