SqlCeException Class

The exception thrown when the underlying provider returns a warning or error from a SQL Server Mobile data source. This class cannot be inherited.

Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)

public class SqlCeException : SystemException
public class SqlCeException extends SystemException
public class SqlCeException extends SystemException

This class is created whenever the .NET Compact Framework Data Provider for SQL Server Mobile encounters an error generated from within the SQL Server Mobile Engine. (Other errors are thrown as standard common language runtime exceptions.) SqlCeException always contains at least one instance of SqlCeError.

The following example generates a SqlCeException due to a missing data source, and then displays the exception.

SqlCeConnection conn = new SqlCeConnection("Data Source=nonExistingSource.sdf;");


catch (SqlCeException e)
    // Use SqlCeException properties if you need specific
    // application logic depending on the error condition
    if (25046 == e.NativeError /*SSCE_M_FILENOTFOUND*/)
        // Error specific logic goes here...


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

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.

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions