SqlCeError 클래스

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

상속 계층

System.Object
  System.Data.SqlServerCe.SqlCeError

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

구문

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

SqlCeError 유형에서 다음 멤버를 표시합니다.

속성

  이름 설명
공용 속성 ErrorParameters 오류 매개 변수 중 마지막 세 개를 가져옵니다. 오류 매개 변수는 SQL Server Compact에서 오류에 대한 자세한 내용을 제공하는 데 사용됩니다.
공용 속성 HResult 오류의 형식을 식별하는 HRESULT 값을 반환합니다.
공용 속성 Message 오류를 설명하는 텍스트를 가져옵니다.
공용 속성 NativeError SqlCeError 의 네이티브 오류 번호를 가져옵니다. 이러한 오류에 대한 자세한 내용은 SQL Server Compact 온라인 설명서의 "문제 해결" 단원에서 "SQL Server Compact 오류" 항목을 참조하십시오.
공용 속성 NumericErrorParameters 오류 매개 변수 중 처음 세 개를 가져옵니다. 오류 매개 변수는 SQL Server Compact에서 오류에 대한 자세한 내용을 제공하는 데 사용됩니다.
공용 속성 Source 오류를 생성한 공급자의 이름을 가져옵니다.

맨 위로 이동

메서드

  이름 설명
공용 메서드 Equals (Object에서 상속)
보호된 메서드 Finalize (Object에서 상속)
공용 메서드 GetHashCode (Object에서 상속)
공용 메서드 GetType (Object에서 상속)
보호된 메서드 MemberwiseClone (Object에서 상속)
공용 메서드 ToString 오류 메시지의 전체 텍스트를 가져옵니다. (Object.ToString()을(를) 재정의함)

맨 위로 이동

주의

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

스레드 보안

이 형식의 모든 public static(Microsoft Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.

참고 항목

참조

System.Data.SqlServerCe 네임스페이스

SqlCeErrorCollection

SqlCeException