Compartilhar via


Método SqlCeDataReader.GetBytes

Lê um fluxo de bytes do deslocamento de coluna especificado no buffer como uma matriz que inicia no deslocamento de buffer fornecido.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (em System.Data.SqlServerCe.dll)

Sintaxe

'Declaração
<SecurityTreatAsSafeAttribute> _
<SecurityCriticalAttribute> _
Public Overrides Function GetBytes ( _
    ordinal As Integer, _
    dataIndex As Long, _
    buffer As Byte(), _
    bufferIndex As Integer, _
    length As Integer _
) As Long
'Uso
Dim instance As SqlCeDataReader
Dim ordinal As Integer
Dim dataIndex As Long
Dim buffer As Byte()
Dim bufferIndex As Integer
Dim length As Integer
Dim returnValue As Long

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

Parâmetros

  • ordinal
    Tipo: System.Int32
    O ordinal da coluna de base zero.
  • dataIndex
    Tipo: System.Int64
    O índice no campo em que a operação de leitura deve iniciar.
  • buffer
    Tipo: array<System.Byte[]
    O buffer no qual os fluxos de bytes devem ser lidos.
  • bufferIndex
    Tipo: System.Int32
    O índice para o buffer iniciar a operação de leitura.
  • length
    Tipo: System.Int32
    O comprimento máximo a ser copiado no buffer.

Valor de retorno

Tipo: System.Int64
O número real de bytes lidos.

Implementa

IDataRecord.GetBytes(Int32, Int64, array<Byte[], Int32, Int32)

Exceções

Exceção Condição
InvalidOperationException

A operação não é válida. O SqlCeDataReader pode ser posicionado depois da última linha no conjunto de resultados.

Comentários

GetBytes retorna o número de bytes disponíveis no campo. Na maioria dos casos, esse é o comprimento exato do campo. Entretanto, o número retornado poderá ser menor que o comprimento real do campo, se GetBytes já tiver sido usado para obter bytes do campo. Isso pode acontecer, por exemplo, quando o SqlCeDataReader estiver lendo uma grande estrutura de dados em um buffer. Para obter mais informações, consulte a configuração SequentialAccess para CommandBehavior.

Se você passar um buffer nulluma referência nula (Nothing no Visual Basic), GetBytes retornará o comprimento do campo, em bytes.

Nenhuma conversão é executada; assim, os dados recuperados já devem ser uma matriz de bytes.

Consulte também

Referência

SqlCeDataReader Classe

Namespace System.Data.SqlServerCe