SqlCeReplication 构造函数 (String, String, String, String, String, String, String, String, String, String)

初始化 SqlCeReplication 对象的新实例,并设置连接到发布时必需的属性。

命名空间: System.Data.SqlServerCe
程序集: System.Data.SqlServerCe(在 system.data.sqlserverce.dll 中)

语法

声明
Public Sub New ( _
    internetUrl As String, _
    internetLogin As String, _
    internetPassword As String, _
    publisher As String, _
    publisherDatabase As String, _
    publisherLogin As String, _
    publisherPassword As String, _
    publication As String, _
    subscriber As String, _
    subscriberConnectionString As String _
)
用法
Dim internetUrl As String
Dim internetLogin As String
Dim internetPassword As String
Dim publisher As String
Dim publisherDatabase As String
Dim publisherLogin As String
Dim publisherPassword As String
Dim publication As String
Dim subscriber As String
Dim subscriberConnectionString As String

Dim instance As New SqlCeReplication(internetUrl, internetLogin, internetPassword, publisher, publisherDatabase, publisherLogin, publisherPassword, publication, subscriber, subscriberConnectionString)
public SqlCeReplication (
    string internetUrl,
    string internetLogin,
    string internetPassword,
    string publisher,
    string publisherDatabase,
    string publisherLogin,
    string publisherPassword,
    string publication,
    string subscriber,
    string subscriberConnectionString
)
public:
SqlCeReplication (
    String^ internetUrl, 
    String^ internetLogin, 
    String^ internetPassword, 
    String^ publisher, 
    String^ publisherDatabase, 
    String^ publisherLogin, 
    String^ publisherPassword, 
    String^ publication, 
    String^ subscriber, 
    String^ subscriberConnectionString
)
public SqlCeReplication (
    String internetUrl, 
    String internetLogin, 
    String internetPassword, 
    String publisher, 
    String publisherDatabase, 
    String publisherLogin, 
    String publisherPassword, 
    String publication, 
    String subscriber, 
    String subscriberConnectionString
)
public function SqlCeReplication (
    internetUrl : String, 
    internetLogin : String, 
    internetPassword : String, 
    publisher : String, 
    publisherDatabase : String, 
    publisherLogin : String, 
    publisherPassword : String, 
    publication : String, 
    subscriber : String, 
    subscriberConnectionString : String
)
不适用。

参数

  • internetUrl
    连接到 SQL Server Compact Edition Server Agent 时使用的 URL。
  • internetLogin
    连接到 SQL Server Compact Edition Server Agent 时使用的登录名。
  • internetPassword
    连接到 SQL Server Compact Edition Server Agent 时使用的密码。
  • publisher
    发行者的名称。
  • publisherDatabase
    发布数据库的名称。
  • publisherLogin
    连接到发行者时使用的登录名。
  • publisherPassword
    连接到发行者时使用的登录密码。
  • publication
    已为匿名合并订阅启用的发布名称。
  • subscriber
    订户的名称。
  • subscriberConnectionString
    基于 Windows Mobile 的设备上的 SQL Server Compact Edition 数据库的 OLE DB 连接字符串。

示例

Dim repl As SqlCeReplication = Nothing

Try
    ' Instantiate and configure SqlCeReplication object
    '
    repl = New SqlCeReplication()
    repl.InternetUrl = "https://www.adventure-works.com/sqlmobile/sqlcesa30.dll"
    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"

    ' Create the local SQL Mobile Database subscription
    '
    repl.AddSubscription(AddOption.CreateDatabase)

    ' Synchronize to the SQL Server to populate the Subscription 
    '
    repl.Synchronize()
Catch
    ' Handle errors here
    '
Finally
    ' Dispose the repl object
    '
    repl.Dispose()
End Try
SqlCeReplication repl = null;

try
{
    // Instantiate and configure SqlCeReplication object
    //
    repl = new SqlCeReplication();
    repl.InternetUrl = "https://www.adventure-works.com/sqlmobile/sqlcesa30.dll";
    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";

    // Create a local SQL Mobile Database subscription
    //
    repl.AddSubscription(AddOption.CreateDatabase);

    // Synchronize to the SQL Server database
    //
    repl.Synchronize();
}
catch (SqlCeException)
{
    // Handle errors here
    //
}
finally
{
    // Dispose the repl object
    //
    repl.Dispose();
}

平台

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

Windows Vista、Microsoft Windows XP SP2 和 Windows Server 2003 SP1 支持 Microsoft .NET Framework 3.0。

版本信息

.NET Framework

受以下版本支持:3.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

SqlCeReplication 类
SqlCeReplication 成员
System.Data.SqlServerCe 命名空间