SqlCeError.Message Property

Gets the text describing the error.

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

Syntax

'Declaration
Public ReadOnly Property Message As String
    Get
'Usage
Dim instance As SqlCeError
Dim value As String

value = instance.Message
public string Message { get; }
public:
property String^ Message {
    String^ get ();
}
member Message : string
function get Message () : String

Property Value

Type: System.String
The text describing the error.

Examples

The following example shows how to use the Message property of SqlCeError.

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);
    }
}

See Also

Reference

SqlCeError Class

System.Data.SqlServerCe Namespace