OleDbErrorCollection.CopyTo Methode

Definition

Kopiert die Elemente der OleDbErrorCollection in ein Array.

Überlädt

CopyTo(Array, Int32)

Kopiert die Elemente der OleDbErrorCollection in ein Array, beginnend am angegebenen Index im Array.

CopyTo(OleDbError[], Int32)

Kopiert alle Elemente der aktuellen OleDbErrorCollection in die angegebene OleDbErrorCollection, beginnend am angegebenen Zielindex.

CopyTo(Array, Int32)

Quelle:
OleDbErrorCollection.cs
Quelle:
OleDbErrorCollection.cs
Quelle:
OleDbErrorCollection.cs

Kopiert die Elemente der OleDbErrorCollection in ein Array, beginnend am angegebenen Index im Array.

public:
 virtual void CopyTo(Array ^ array, int index);
public void CopyTo (Array array, int index);
abstract member CopyTo : Array * int -> unit
override this.CopyTo : Array * int -> unit
Public Sub CopyTo (array As Array, index As Integer)

Parameter

array
Array

Das Array, in das die Elemente kopiert werden sollen.

index
Int32

Der Anfangsindex von array.

Implementiert

Ausnahmen

Die Summe von index und der Anzahl der Elemente in der OleDbErrorCollection ist größer als die Länge des Array.

array ist null.

Der index ist ungültig für array.

Beispiele

Im folgenden Beispiel werden alle OleDbError innerhalb der OleDbErrorCollection Auflistung angezeigt.

public void DisplayOleDbErrorCollection(OleDbException 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 DisplayOleDbErrorCollection(exception As OleDbException)
    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

Weitere Informationen

Gilt für:

CopyTo(OleDbError[], Int32)

Quelle:
OleDbErrorCollection.cs
Quelle:
OleDbErrorCollection.cs
Quelle:
OleDbErrorCollection.cs

Kopiert alle Elemente der aktuellen OleDbErrorCollection in die angegebene OleDbErrorCollection, beginnend am angegebenen Zielindex.

public:
 void CopyTo(cli::array <System::Data::OleDb::OleDbError ^> ^ array, int index);
public void CopyTo (System.Data.OleDb.OleDbError[] array, int index);
member this.CopyTo : System.Data.OleDb.OleDbError[] * int -> unit
Public Sub CopyTo (array As OleDbError(), index As Integer)

Parameter

array
OleDbError[]

Die OleDbErrorCollection, die das Ziel der aus der aktuellen OleDbErrorCollection kopierten Elemente ist.

index
Int32

Eine 32-Bit-Ganzzahl, die den Index in der OleDbErrorCollection darstellt, ab dem kopiert werden soll.

Beispiele

Im folgenden Beispiel werden alle OleDbError innerhalb der OleDbErrorCollection Auflistung angezeigt.

public void DisplayOleDbErrorCollection(OleDbException 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 DisplayOleDbErrorCollection(exception As OleDbException)
    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

Weitere Informationen

Gilt für: