Freigeben über


SqlCeReplication-Konstruktor ()

Hinweis: Dieser Namespace oder Member bzw. diese Klasse wird nur von .NET Framework, Version 1.1, unterstützt.

Initialisiert eine neue Instanz des SqlCeReplication-Objekts. Standardkonstruktor.

Public Sub New()
[C#]
public SqlCeReplication();
[C++]
public: SqlCeReplication();
[JScript]
public function SqlCeReplication();

Hinweise

Der Basiskonstruktor initialisiert alle Felder mit ihren Standardwerten. Sie können den Wert jeder dieser Eigenschaften durch einen gesonderten Aufruf der betreffenden Eigenschaft ändern.

Beispiel

 
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"
   
   ' Create the Local SSCE Database subscription
   repl.AddSubscription(AddOption.CreateDatabase)
   
   ' 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";

            // Create the Local SSCE Database subscription
            repl.AddSubscription(AddOption.CreateDatabase);

            // 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] Für C++ oder JScript ist kein Beispiel verfügbar. Klicken Sie zum Anzeigen eines Beispiels für Visual Basic oder C# in der linken oberen Ecke der Seite auf die Schaltfläche "Sprachfilter" Sprachfilter.

Anforderungen

Plattformen: .NET Compact Framework - Windows CE .NET

.NET Framework-Sicherheit:

Siehe auch

SqlCeReplication-Klasse | SqlCeReplication-Member | System.Data.SqlServerCe-Namespace | SqlCeReplication-Konstruktorüberladungsliste