SqlCeException.NativeError 속성

SqlCeErrorCollection에 있는 첫 번째 SqlCeError의 네이티브 오류 번호를 가져옵니다. 오류에 대한 자세한 내용은 SQL Server Compact 온라인 설명서의 "문제 해결" 단원에서 "SQL Server Compact 오류" 항목을 참조하십시오.

네임스페이스:  System.Data.SqlServerCe
어셈블리:  System.Data.SqlServerCe(System.Data.SqlServerCe.dll)

구문

‘선언
Public ReadOnly Property NativeError As Integer
    Get
‘사용 방법
Dim instance As SqlCeException
Dim value As Integer

value = instance.NativeError
public int NativeError { get; }
public:
property int NativeError {
    int get ();
}
member NativeError : int
function get NativeError () : int

속성 값

유형: System.Int32
Int32 를 반환합니다.

다음 예제에서는 SqlCeErrorCollection 컬렉션 내에 있는 첫 번째 SqlCeErrorMessageNativeError 속성을 표시합니다.

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

참고 항목

참조

SqlCeException 클래스

System.Data.SqlServerCe 네임스페이스