Share via


OdbcDataReader.GetChars(Int32, Int64, Char[], Int32, Int32) Metodo

Definizione

Legge un flusso di caratteri dall'offset della colonna specificata nel buffer come una matrice, a partire dall'offset del buffer specificato.

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 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);
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

Parametri

i
Int32

Ordinale di colonna in base zero.

dataIndex
Int64

Indice all'interno della riga dalla quale iniziare l'operazione di lettura.

buffer
Char[]

Buffer in cui copiare i dati.

bufferIndex
Int32

Indice all'interno del parametro buffer dal quale iniziare l'operazione di scrittura.

length
Int32

Numero di caratteri da leggere.

Restituisce

Numero effettivo di caratteri letti.

Implementazioni

Commenti

GetChars restituisce il numero di caratteri disponibili nel campo . La maggior parte del tempo è la lunghezza esatta del campo. Tuttavia, il numero restituito può essere minore della lunghezza effettiva del campo se è già stato usato il metodo GetChars per ottenere i caratteri del campo. Questo può essere il caso, ad esempio, se sta OdbcDataReader leggendo una struttura di dati di grandi dimensioni in un buffer. Per altre informazioni, vedere l'impostazione SequentialAccess per CommandBehavior.

Se si passa un buffer che è un valore Null, GetChars restituisce la lunghezza del campo in caratteri.

Le conversioni vengono eseguite in base alle funzionalità sottostanti del driver ODBC. Se la conversione non è supportata, la chiamata al metodo avrà esito negativo.

Nota

Non verrà generata alcuna eccezione se il valore di bufferIndex è esterno alla matrice. Non verranno letti dati e il metodo restituirà 0.

Si applica a

Vedi anche