Click to Rate and Give Feedback
MSDN
MSDN Library
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
SqlCeReplication.LoadProperties Method

Retrieves all values stored for the synchronization properties, and then populates the SqlCeReplication class properties with these saved values.

Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)
VisualBasicDeclaration
Public Function LoadProperties As Boolean
CSharp
public bool LoadProperties ()
ManagedCPlusPlus
public:
bool LoadProperties ()
JSharp
public boolean LoadProperties ()
JScript
public function LoadProperties () : boolean

For the LoadProperties function to succeed, you must provide all of the SqlCeReplication object properties unless the database specified in the SubscriberConnectionString has only one subscription. If the database subscribes to only one publication, you can omit the following properties:

If LoadProperties is called without setting these properties, and more than one subscription exists in the database, an error is raised for each subscription in the database. Each error in the collection contains the string parameters of the Publisher, Publication, and PublisherDatabase properties for each subscription in the database.

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 LoadProperties method.

VisualBasic
Try
    '
    '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.
    '
    Dim repl As New SqlCeReplication()
    repl.SubscriberConnectionString = "Data Source='Test.sdf'; Pwd='<enterStrongPassword>'"
    repl.LoadProperties()

    repl.Synchronize()
Catch
    ' Handle errors here
End Try
CSharp
try
{
    //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.
    //
    SqlCeReplication repl = new SqlCeReplication();
    repl.SubscriberConnectionString = "Data Source='Test.sdf'; Pwd='<enterStrongPassword>'";
    repl.LoadProperties();

    repl.Synchronize();
}
catch (SqlCeException)
{
    // Handle errors here
}
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

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
Version Information
.NET Framework and NET Compact Framework
Supported in 3.5
.NET Framework
Supported in 3.0
.NET Compact Framework and .Net Framework
Supported in 2.0

© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker