OdbcErrorCollection.CopyTo Método
Definição
Copia os elementos de OdbcErrorCollection para uma matriz, começando pelo índice especificado dentro da matriz.Copies the elements of the OdbcErrorCollection into an array, starting at the specified index within the array.
Sobrecargas
| CopyTo(Array, Int32) |
Copia os elementos de OdbcErrorCollection para uma matriz, começando pelo índice especificado dentro da matriz.Copies the elements of the OdbcErrorCollection into an array, starting at the specified index within the array. |
| CopyTo(OdbcError[], Int32) |
Copia todos os elementos do OdbcErrorCollection atual para o OdbcErrorCollection especificado, começando no índice de destino especificado.Copies all the elements of the current OdbcErrorCollection to the specified OdbcErrorCollection starting at the specified destination index. |
CopyTo(Array, Int32)
Copia os elementos de OdbcErrorCollection para uma matriz, começando pelo índice especificado dentro da matriz.Copies the elements of the OdbcErrorCollection into an array, starting at the specified index within the array.
public:
virtual void CopyTo(Array ^ array, int i);
public void CopyTo (Array array, int i);
abstract member CopyTo : Array * int -> unit
override this.CopyTo : Array * int -> unit
Public Sub CopyTo (array As Array, i As Integer)
Parâmetros
- array
- Array
A matriz para a qual copiar os elementos.The array into which to copy the elements.
- i
- Int32
O índice inicial de array.The starting index of array.
Implementações
Exceções
A soma de index e o número de elementos em OdbcErrorCollection é maior que o tamanho da matriz.The sum of index and the number of elements in the OdbcErrorCollection is greater than the length of the array.
O array é null.The array is null.
O index não é válido para array.The index is not valid for array.
Exemplos
O exemplo a seguir exibe cada OdbcError uma dentro da OdbcErrorCollection coleção.The following example displays each OdbcError within the OdbcErrorCollection collection.
public void DisplayOdbcErrorCollection(OdbcException exception)
{
for (int i=0; i < exception.Errors.Count; i++)
{
MessageBox.Show("Index #" + i + "\n" +
"Message: " + exception.Errors[i].Message + "\n" +
"Native: " + exception.Errors[i].NativeError.ToString() + "\n" +
"Source: " + exception.Errors[i].Source + "\n" +
"SQL: " + exception.Errors[i].SQLState + "\n");
}
}
Public Sub DisplayOdbcErrorCollection(exception As OdbcException)
Dim i As Integer
For i = 0 To exception.Errors.Count - 1
MessageBox.Show("Index #" + i.ToString() + ControlChars.Cr _
+ "Message: " + exception.Errors(i).Message + ControlChars.Cr _
+ "Native: " + exception.Errors(i).NativeError.ToString() + ControlChars.Cr _
+ "Source: " + exception.Errors(i).Source + ControlChars.Cr _
+ "SQL: " + exception.Errors(i).SQLState + ControlChars.Cr)
Next i
End Sub
Aplica-se a
CopyTo(OdbcError[], Int32)
Copia todos os elementos do OdbcErrorCollection atual para o OdbcErrorCollection especificado, começando no índice de destino especificado.Copies all the elements of the current OdbcErrorCollection to the specified OdbcErrorCollection starting at the specified destination index.
public:
void CopyTo(cli::array <System::Data::Odbc::OdbcError ^> ^ array, int i);
public void CopyTo (System.Data.Odbc.OdbcError[] array, int i);
member this.CopyTo : System.Data.Odbc.OdbcError[] * int -> unit
Public Sub CopyTo (array As OdbcError(), i As Integer)
Parâmetros
- array
- OdbcError[]
Um OdbcErrorCollection que é o destino dos elementos copiados do OdbcErrorCollection atual.The OdbcErrorCollection that is the destination of the elements copied from the current OdbcErrorCollection.
- i
- Int32
Um inteiro de 32 bits que representa o índice no OdbcErrorCollection no qual a cópia é iniciada.A 32-bit integer that represents the index in the OdbcErrorCollection at which copying starts.
Exemplos
O exemplo a seguir exibe cada OdbcError uma dentro da OdbcErrorCollection coleção.The following example displays each OdbcError within the OdbcErrorCollection collection.
public void DisplayOdbcErrorCollection(OdbcException exception)
{
for (int i=0; i < exception.Errors.Count; i++)
{
MessageBox.Show("Index #" + i + "\n" +
"Message: " + exception.Errors[i].Message + "\n" +
"Native: " + exception.Errors[i].NativeError.ToString() + "\n" +
"Source: " + exception.Errors[i].Source + "\n" +
"SQL: " + exception.Errors[i].SQLState + "\n");
}
}
Public Sub DisplayOdbcErrorCollection(exception As OdbcException)
Dim i As Integer
For i = 0 To exception.Errors.Count - 1
MessageBox.Show("Index #" + i.ToString() + ControlChars.Cr _
+ "Message: " + exception.Errors(i).Message + ControlChars.Cr _
+ "Native: " + exception.Errors(i).NativeError.ToString() + ControlChars.Cr _
+ "Source: " + exception.Errors(i).Source + ControlChars.Cr _
+ "SQL: " + exception.Errors(i).SQLState + ControlChars.Cr)
Next i
End Sub