Condividi tramite


SqlCeReplication Constructor

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

Overload List

Initializes a new instance of the SqlCeReplication object. Default Constructor.

Supported only by the .NET Compact Framework.

[Visual Basic] Public Sub New()

[C#] public SqlCeReplication();

[C++] public: SqlCeReplication();

[JScript] public function SqlCeReplication();

Initializes a new instance of the SqlCeReplication object and configures replication for Basic or Integrated authentication to IIS and Integrated Windows Authentication to SQL Server.

Supported only by the .NET Compact Framework.

[Visual Basic] Public Sub New(String, String, String, String, String, String, String, String)

[C#] public SqlCeReplication(string, string, string, string, string, string, string, string);

[C++] public: SqlCeReplication(String*, String*, String*, String*, String*, String*, String*, String*);

[JScript] public function SqlCeReplication(String, String, String, String, String, String, String, String);

Initializes a new instance of the SqlCeReplication object and configures replication for Basic or Integrated authentication to IIS and SQL Server Authentication to SQL Server.

Supported only by the .NET Compact Framework.

[Visual Basic] Public Sub New(String, String, String, String, String, String, String, String, String, String)

[C#] public SqlCeReplication(string, string, string, string, string, string, string, string, string, string);

[C++] public: SqlCeReplication(String*, String*, String*, String*, String*, String*, String*, String*, String*, String*);

[JScript] public function SqlCeReplication(String, String, String, String, String, String, String, String, String, String);

Example

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of the SqlCeReplication constructor. For other examples that might be available, see the individual overload topics.

  [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"
   
   ' 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] 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.

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.