SqlCeReplication.ReinitializeSubscription Method
Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.
Marks a subscription for reinitialization. After calling ReinitializeSubscription, an application must call the Synchronize method to download the latest snapshot of the publication to the device.
[Visual Basic] Public Sub ReinitializeSubscription( _ ByVal uploadBeforeReinit As Boolean _ ) [C#] public void ReinitializeSubscription(bool uploadBeforeReinit ); [C++] public: void ReinitializeSubscription(bool uploadBeforeReinit ); [JScript] public function ReinitializeSubscription( uploadBeforeReinit : Boolean);
Parameters
- uploadBeforeReinit
If True, the changes in the subscription database are uploaded to the Publisher before the snapshot is applied at the Subscriber. The default is False.
Remarks
A flag is marked in the SQL Server CE subscription system table to signify that during the next synchronization, the subscription should be reinitialized. After calling the ReinitializeSubscription method, the application must call the Synchronize method to delete the existing replica and download a new replica of the publication to the Windows CE .NET-based device.
Example
[Visual Basic] Dim repl As SqlCeReplication = Nothing Try ' Set the Replication object repl = New SqlCeReplication() repl.InternetUrl = "<http://www.northwindtraders.com/sqlce/sscesa20.dll>" repl.InternetLogin = "MyLogin" repl.InternetPassword = "<password>" repl.Publisher = "MyPublisher" repl.PublisherDatabase = "MyPublisher Database" repl.PublisherLogin = "MyPublisher Login" repl.PublisherPassword = "<password>" repl.Publication = "MyPublication" repl.Subscriber = "MySub" repl.SubscriberConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\ssce.sdf" ' Mark the subscription for reinitialization with Upload first. repl.ReinitializeSubscription(true) ' Synchronize to the SQL Server 2000 to populate the Subscription repl.Synchronize() Catch e As SqlCeException ' Use your own error handling routine to show error information. ' ShowError.ShowErrors(e); Finally ' Dispose of the Replication Object repl.Dispose() End Try [C#] SqlCeReplication repl = null; try { // Set the Replication object repl = new SqlCeReplication(); repl.InternetUrl = "<http://www.northwindtraders.com/sqlce/sscesa20.dll>"; repl.InternetLogin = "MyLogin"; repl.InternetPassword = "<password>"; repl.Publisher = "MyPublisher"; repl.PublisherDatabase = "MyPublisher Database"; repl.PublisherLogin = "MyPublisher Login"; repl.PublisherPassword = "<password>"; repl.Publication = "MyPublication"; repl.Subscriber = "MySub"; repl.SubscriberConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\\ssce.sdf"; // Mark the subscription for reinitialization with Upload first. repl.ReinitializeSubscription(true); // Synchronize to the SQL Server 2000 to populate the Subscription repl.Synchronize(); } catch(SqlCeException) { // Use your own error handling routine to show error information. // ShowError.ShowErrors(e); } finally { // Dispose of the Replication Object repl.Dispose(); }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button in the upper-left corner of the page.
Requirements
Platforms: .NET Compact Framework
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code
See Also
SqlCeReplication Class | SqlCeReplication Members | System.Data.SqlServerCe Namespace
Syntax based on .NET Framework version 1.1.
Documentation version 1.1.1.