SqlCeReplication.Synchronize Method

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Invokes merge replication between the SQL Server CE subscription and the SQL Server Publisher.

  [Visual Basic]
  Public Sub Synchronize()

  [C#]
  public void Synchronize();
[C++]
public: void Synchronize();
[JScript]
public function Synchronize();

Remarks

Any other connection to the database must be closed prior to calling Synchronize.

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"
   
   ' 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";

            // Synchronize to the SQL Server 2000 to populate the Subscription 
            repl.Synchronize();
        }
        catch(SqlCeException) {
            // Use your own error handling routine to show error information.
        }

        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 Language Filter in the upper-left corner of the page.

Requirements

Platforms: .NET Compact Framework

.NET Framework Security:

See Also

SqlCeReplication Class | SqlCeReplication Members | System.Data.SqlServerCe Namespace

Syntax based on .NET Framework version 1.1.
Documentation version 1.1.1.

Send comments on this topic.

© Microsoft Corporation. All rights reserved.