This documentation is archived and is not being maintained.

SqlCeReplication.SaveProperties Method

Retrieves all of the values stored in the Replication class properties for the current subscription and stores them in a system table.

Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in

public void SaveProperties ()
public void SaveProperties ()
public function SaveProperties ()

A subscription must be successfully created prior to saving the synchronization properties; all required parameters to run the synchronization must be supplied for call to SaveProperties to succeed. If non-required parameters are omitted when saving the synchronization properties, they will be set to their default values, even if saved synchronization properties already exist. To avoid properties being overwritten, a user should first retrieve the synchronization properties by calling LoadProperties, change the particular properties, and then re-save the synchronization properties.

When SaveProperties is called, the values for the password properties are stored in the database. These values are automatically encrypted with the unique device hardware key. Therefore, if you create a subscription profile on one device (or a server), and then copy the database to a new device, LoadProperties will fail to retrieve the password from the profile. You can provide the correct password manually and then call SaveProperties again to persist the profile on the new device.

The following example shows how to use the SaveProperties method.

SqlCeReplication repl = null;

    // Create SqlCeReplication instance
    repl = new SqlCeReplication();
    repl.InternetUrl = "";
    repl.InternetLogin = "MyInternetLogin";
    repl.InternetPassword = "<password>";
    repl.Publisher = "MyPublisher";
    repl.PublisherDatabase = "MyPublisherDatabase";
    repl.PublisherLogin = "MyPublisherLogin";
    repl.PublisherPassword = "<password>";
    repl.Publication = "MyPublication";
    repl.Subscriber = "MySubscriber";
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf";

    // Store all the properties in the database

    // In the future all you need to do is load the properties
    repl = new SqlCeReplication();
    repl.SubscriberConnectionString = "Data Source='Test.sdf'; Pwd='<password>'";

    // Now the SqlCeReplication instance is ready to sync

catch (SqlCeException)
    // Handle errors here

    // Dispose the repl object

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Compact Framework

Supported in: 2.0