Dim repl As SqlCeReplication = Nothing
Try
repl = New SqlCeReplication
'Set the properties using data from the UI.
repl.Publisher = "dievechnology"
repl.PublisherLogin = "sa"
'repl.PublisherPassword = " "
repl.InternetUrl = "C:/Inetpub/wwwroot/Sean/sscesa20.dll"
'repl.InternetPassword = " "
repl.Subscriber = "Sean"
repl.Publication = "DIEVECHNOLOGY\Keen"
repl.PublisherDatabase = "Sean"
strDataSource = "\My Documents\Sean"
ssceConn.ConnectionString = "Data Source =" + strDataSource
repl.SubscriberConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=" + strDataSource
'If the file does not exist, create it, and add it as a subscription.
While System.IO.File.Exists(strDataSource) = False
If MessageBox.Show("The file does not exist, do you want to create it?", _
"Merge", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, _
MessageBoxDefaultButton.Button1) = DialogResult.Yes Then
repl.AddSubscription(AddOption.CreateDatabase)
Me.Refresh()
End If
End While
'Synchronize.
repl.Synchronize()
Catch err As SqlCeException
'Add error handling code here.
MessageBox.Show(Err.Message)
Finally
repl.Dispose()
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim repl As SqlCeReplication = Nothing
Try
' Set the Replication object.
repl = New SqlCeReplication
repl.InternetUrl = "C:/Inetpub/wwwroot/Sean/sscesa20.dll"
repl.InternetLogin = "MyLogin"
repl.InternetPassword = " "
repl.Publisher = "dievechnology"
repl.PublisherDatabase = "MyPublisher Database"
repl.PublisherLogin = " "
repl.PublisherPassword = "<MyPublisher Password>"
repl.Publication = "MyPublication"
repl.SubscriberConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\Sean.sdf"
repl.Subscriber = "MySubscriber"
' Mark the subscription for reinitialization with Upload first.
repl.ReinitializeSubscription(True)
' Synchronize to the instance of SQL Server 2000 to populate the Subscription.
repl.Synchronize()
Catch ex As SqlCeException
' Use your own error handling routine to show error information.
' ShowErrors(e)
MessageBox.Show(ex.Message)
Finally
' Dispose of the Replication object.
repl.Dispose()
End Try