다음을 통해 공유


SqlCeReplication.ReinitializeSubscription Method

다시 초기화할 구독을 표시합니다. 이 메서드를 호출한 후 응용 프로그램에서는 Synchronize 메서드를 호출하여 게시의 최신 스냅숏을 장치로 다운로드해야 합니다.

네임스페이스: System.Data.SqlServerCe
어셈블리: System.Data.SqlServerCe(system.data.sqlserverce.dll에 있음)

구문

‘선언
Public Sub ReinitializeSubscription ( _
    uploadBeforeReinitialize As Boolean _
)
public void ReinitializeSubscription (
    bool uploadBeforeReinitialize
)
public:
void ReinitializeSubscription (
    bool uploadBeforeReinitialize
)
public void ReinitializeSubscription (
    boolean uploadBeforeReinitialize
)
public function ReinitializeSubscription (
    uploadBeforeReinitialize : boolean
)

매개 변수

  • uploadBeforeReinitialize
    True인 경우 구독 데이터베이스의 변경 사항은 스냅숏이 구독자에서 적용되기 전에 게시자로 업로드됩니다. 기본값 False입니다.

주의

다음에 동기화할 때 구독을 다시 초기화할지를 나타내는 플래그가 SQL Server Compact 3.5 구독 시스템 테이블에 표시됩니다. ReinitializeSubscription 메서드를 호출한 후 응용 프로그램에서는 Synchronize 메서드를 호출하여 기존 복제본을 삭제하고 게시의 새 복제본을 Windows Mobile 기반 장치로 다운로드해야 합니다.

Dim repl As SqlCeReplication = Nothing

Try
    ' Create SqlCeReplication instance
    '
    'NOTE: when possible, prompt users to enter security 
    'credentials at runtime. If you store credentials in a file, 
    'you must secure the file to prevent unauthorized access.
    '
    repl = New SqlCeReplication()
    repl.InternetUrl = "https://www.adventure-works.com/sqlmobile/sqlcesa35.dll"
    repl.InternetLogin = "MyInternetLogin"
    repl.InternetPassword = "<enterStrongPassword>"
    repl.Publisher = "MyPublisher"
    repl.PublisherDatabase = "MyPublisherDatabase"
    repl.PublisherLogin = "MyPublisherLogin"
    repl.PublisherPassword = "<enterStrongPassword>"
    repl.Publication = "MyPublication"
    repl.Subscriber = "MySubscriber"
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf"

    ' Mark the subscription for reinitialization with Upload first
    '
    repl.ReinitializeSubscription(True)

    ' Synchronize to the SQL Server to populate the Subscription 
    '
    repl.Synchronize()
Catch
    ' Handle errors here
Finally
    ' Dispose the repl object
    '
    repl.Dispose()
End Try
SqlCeReplication repl = null;

try
{
    // Create SqlCeReplication instance
    //
    //NOTE: when possible, prompt users to enter security 
    //credentials at runtime. If you store credentials in a file, 
    //you must secure the file to prevent unauthorized access.
    //
    repl = new SqlCeReplication();
    repl.InternetUrl = "https://www.adventure-works.com/sqlmobile/sqlcesa35.dll";
    repl.InternetLogin = "MyInternetLogin";
    repl.InternetPassword = "<enterStrongPassword>";
    repl.Publisher = "MyPublisher";
    repl.PublisherDatabase = "MyPublisherDatabase";
    repl.PublisherLogin = "MyPublisherLogin";
    repl.PublisherPassword = "<enterStrongPassword>";
    repl.Publication = "MyPublication";
    repl.Subscriber = "MySubscriber";
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf";

    // Mark the subscription for reinitialization with Upload first
    //
    repl.ReinitializeSubscription(true);

    // Synchronize to the SQL Server to populate the Subscription 
    //
    repl.Synchronize();
}
catch (SqlCeException)
{
    // Handle errors here
}
finally
{
    // Dispose the repl object
    //
    repl.Dispose();
}

스레드 보안

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

플랫폼

개발 플랫폼

Windows Vista, Windows Mobile 5.0, Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Mobile 2003 for Pocket PC, Windows CE 5.0
버전 정보
.NET Framework 및 NET Compact Framework
3.5에서 지원됨
.NET Framework
3.0에서 지원됨
.NET Compact Framework 및 .Net Framework
2.0에서 지원됨

참고 항목

참조

SqlCeReplication Class
SqlCeReplication Members
System.Data.SqlServerCe Namespace