다음을 통해 공유


SqlCeError 클래스

데이터 원본이 반환한 경고 또는 오류와 관련된 정보를 수집합니다. 이 클래스는 상속될 수 없습니다.

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

구문

‘선언
Public NotInheritable Class SqlCeError
‘사용 방법
Dim instance As SqlCeError
public sealed class SqlCeError
public ref class SqlCeError sealed
[<SealedAttribute>]
type SqlCeError =  class end
public final class SqlCeError

주의

SqlCeError의 인스턴스는 오류가 발생할 때 System.Data.SqlServerCe 관리되는 공급자에 의해 만들어집니다. SqlCeErrorCollection에는 SqlCeError의 인스턴스가 하나 이상 포함됩니다.

예제

다음 예제에서는 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);
    }
}

상속 계층 구조

System. . :: . .Object
  System.Data.SqlServerCe..::..SqlCeError

스레드로부터의 안전성

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.

참고 항목

참조

SqlCeError 멤버

System.Data.SqlServerCe 네임스페이스

SqlCeErrorCollection

SqlCeException