SqlCeErrorCollection Class

Collects all errors generated by the .NET Compact Framework Data Provider for SQL Server Compact. This class cannot be inherited.

System.Object
  System.Data.SqlServerCe.SqlCeErrorCollection

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

'Declaration
<SerializableAttribute> _
Public NotInheritable Class SqlCeErrorCollection _
	Implements ICollection, IEnumerable
'Usage
Dim instance As SqlCeErrorCollection

The SqlCeErrorCollection type exposes the following members.

  NameDescription
Public propertyCountGets the number of SqlCeError objects in the collection.
Public propertyItemGets the error at the specified index.
Top

  NameDescription
Public methodCopyToCopies the elements of the SqlCeErrorCollection into an Array, starting at the given index within the Array.
Public methodEquals (inherited from Object)
Protected methodFinalize (inherited from Object)
Public methodGetEnumeratorInfrastructure. Returns an enumerator that can iterate through the SqlCeErrorCollection.
Public methodGetHashCode (inherited from Object)
Public methodGetType (inherited from Object)
Protected methodMemberwiseClone (inherited from Object)
Public methodToString (inherited from Object)
Top

This class is created by SqlCeException to collect instances of the SqlCeError class. SqlCeErrorCollection always contains at least one instance of the SqlCeError class.

The following example displays each SqlCeError within the SqlCeErrorCollection collection.

Public Sub DisplaySqlCeErrors(ByVal errorCollection As SqlCeErrorCollection)

    Dim err As SqlCeError
    Dim bld As New StringBuilder()

    For Each err In errorCollection
        bld.Append((ControlChars.Cr & " Error Code: " & err.HResult.ToString("X")))
        bld.Append((ControlChars.Cr & " Message   : " & err.Message))
        bld.Append((ControlChars.Cr & " Minor Err.: " & err.NativeError))
        bld.Append((ControlChars.Cr & " Source    : " & err.Source))

        Dim numPar As Integer
        For Each numPar In err.NumericErrorParameters
            If 0 <> numPar Then
                bld.Append((ControlChars.Cr & " Num. Par. : " & numPar))
            End If
        Next numPar

        Dim errPar As String
        For Each errPar In err.ErrorParameters
            If [String].Empty <> errPar Then
                bld.Append((ControlChars.Cr & " Err. Par. : " & errPar))
            End If
        Next errPar

        MessageBox.Show(bld.ToString())
        bld.Remove(0, bld.Length)
    Next err

End Sub 'DisplaySqlCeErrors


Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: