Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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)
[SerializableAttribute]
public sealed class SqlCeErrorCollection : ICollection, 
	IEnumerable

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 void DisplaySqlCeErrors(SqlCeErrorCollection errorCollection ) {
    StringBuilder bld = new StringBuilder();

    foreach (SqlCeError err in errorCollection) {
        bld.Append("\n Error Code: " + err.HResult.ToString("X"));
        bld.Append("\n Message   : " + err.Message);
        bld.Append("\n Minor Err.: " + err.NativeError);
        bld.Append("\n Source    : " + err.Source);

        foreach (int numPar in err.NumericErrorParameters) {
            if (0 != numPar) bld.Append("\n Num. Par. : " + numPar);
        }

        foreach (string errPar in err.ErrorParameters) {
            if (String.Empty != errPar) bld.Append("\n Err. Par. : " + errPar);
        }

        MessageBox.Show(bld.ToString());
        bld.Remove(0, bld.Length);
    }
}


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.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.