Condividi tramite


SqlCeReplication Constructor (String, String, String, String, String, String, String, String)

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

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.

  [Visual Basic]
  Public Sub New( _
   ByVal 
  internetUrl
   As String, _
   ByVal internetLogin As String, _
   ByVal internetPassword As String, _
   ByVal publisher As String, _
   ByVal publisherDatabase As String, _
   ByVal publication As String, _
   ByVal subscriber As String, _
   ByVal subscriberConnectionString As String _
)
[C#]
public SqlCeReplication(
   string internetUrl,string internetLogin,string internetPassword,string publisher,string publisherDatabase,string publication,string subscriber,string subscriberConnectionString
);
[C++]
public: SqlCeReplication(
   String* internetUrl,String* internetLogin,String* internetPassword,String* publisher,String* publisherDatabase,String* publication,String* subscriber,String* subscriberConnectionString
);
[JScript]
public function SqlCeReplication(
   internetUrl : String,
 internetLogin : String,
 internetPassword : String,
 publisher : String,
 publisherDatabase : String,
 publication : String,
 subscriber : String,
 subscriberConnectionString : String);

Parameters

  • internetUrl
    The URL used to connect to the SQL Server CE Server Agent.
  • internetLogin
    The login name used when connecting to the SQL Server CE Server Agent.
  • internetPassword
    The password used when connecting to the SQL Server CE Server Agent.
  • publisher
    The name of the Publisher.
  • publisherDatabase
    The name of the publication database.
  • publication
    The publication name that has been enabled for anonymous merge subscriptions.
  • subscriber
    The name of the Subscriber.
  • subscriberConnectionString
    The OLE DB connection string for the SQL Server CE database on the Windows CE .NET-based device.

Remarks

The following table shows initial property values for an instance of SqlCeReplication:

Property Initial value
ExchangeType bi-directional
LoginTimeout 15
PublisherNetwork defaultNetwork
PublisherSecurityMode NTAuthentication
QueryTimeout 30
Validate NoValidation

Example

[Visual Basic, C#] This example uses the AddSubscription and Synchronize methods to create a new subscription database.

  [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.

Requirements

Platforms: .NET Compact Framework

.NET Framework Security:

See Also

SqlCeReplication Class | SqlCeReplication Members | System.Data.SqlServerCe Namespace | SqlCeReplication Constructor Overload List

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

Send comments on this topic.

© Microsoft Corporation. All rights reserved.