SqlCeException.Errors Property
Gets a collection of one or more SqlCeError objects that contain detailed information about exceptions generated by the .NET Compact Framework Data Provider for SQL Server Mobile.
Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)
Syntax
'Declaration
Public ReadOnly Property Errors As SqlCeErrorCollection
'Usage
Dim instance As SqlCeException
Dim value As SqlCeErrorCollection
value = instance.Errors
public SqlCeErrorCollection Errors { get;
public:
property SqlCeErrorCollection^ Errors {
SqlCeErrorCollection^ get ();
/** @property */
public SqlCeErrorCollection get_Errors ()
public function get Errors () : SqlCeErrorCollection
Property Value
The SqlCeErrorCollection object that contains the collected instances of the SqlCeError class for the exception.
Remarks
The SqlCeErrorCollection class always contains at least one instance of the SqlCeError class.
Example
The following example displays each SqlCeError within the SqlCeErrorCollection collection.
Try
Dim repl As New SqlCeReplication()
' Fill repl properites here
' ...
' SqlCeReplication may throw SqlCeException which contains a
' collection of errors; SQL Mobile database engine always
' returns one error in the collection
'
repl.Synchronize()
Catch e As SqlCeException
Dim err As SqlCeError
For Each err In e.Errors
' Use SqlCeError properties if you need specific
' application logic depending on the error condition
'
If 28577 = [err].NativeError Then 'SSCE_M_SCHEMAHASCHANGED
' Error specific logic goes here...
'
End If
' Note: For native error numbers, refer to SQL Server Mobile Errors
' in the SQL Server Mobile Books Online
'
MessageBox.Show([err].Message)
Next err
End Try
try
{
SqlCeReplication repl = new SqlCeReplication();
// Fill repl properites here
// ...
// SqlCeReplication may throw SqlCeException which contains a
// collection of errors; SQL Mobile database engine always
// returns one error in the collection
//
repl.Synchronize();
catch (SqlCeException e)
{
foreach (SqlCeError error in e.Errors)
{
// Use SqlCeError properties if you need specific
// application logic depending on the error condition
//
if (28577 == error.NativeError /*SSCE_M_SCHEMAHASCHANGED*/)
{
// Error specific logic goes here...
//
// Note: For native error numbers, refer to SQL Server Mobile Errors
// in the SQL Server Mobile Books Online
//
MessageBox.Show(error.Message);
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .
Platforms
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Version Information
.NET Compact Framework
Supported in: 2.0, 1.0
See Also
Reference
SqlCeException Class
SqlCeException Members
System.Data.SqlServerCe Namespace