|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
VB.NET ActiveX Replication , block of code does not execute
I need to write an application in VB.NET to syncronize data in between 2
server. I have implement a Merge Replication in between this 2 servers. After I run the applicaton as code describe over here, I got syncronized data in this 2 servers. But The Statusbar and Status message of executing does not work. I have run step by step executing but the procedure myMergeObj_Status is never get in. Could you tell me how can I solve this problem? Thanks for your helps, Imports SQLMERGXLib Imports REPLERRXLib Public Class MainForm Inherits System.Windows.Forms.Form Private WithEvents myMergeObj As New SQLMerge() Private myReplErr As New SQLReplError() Private strMessage As String Private blnCancel As Boolean Private Sub SyncronizeSreverReplication() cmdSync.Enabled = False blnCancel = False cmdCancel.Enabled = True cmdClose.Enabled = False With myMergeObj .Publisher = txtPublisherServer.Text .PublisherDatabase = txtPublicationDB.Text .Publication = txtPublicationName.Text .PublisherSecurityMode = SECURITY_TYPE.NT_AUTHENTICATION .Subscriber = txtSubscriberServer.Text .SubscriberDatabase = txtSubscriptionDB.Text .SubscriberSecurityMode = SECURITY_TYPE.NT_AUTHENTICATION .SubscriptionType = SUBSCRIPTION_TYPE.ANONYMOUS End With Try myMergeObj.Initialize() myMergeObj.Run() myMergeObj.Terminate() MsgBox("Update is complete - " & strMessage) BarSyncProgress.Value = 0 Catch ex As Exception Dim errString As String If myMergeObj.ErrorRecords.Count > 0 Then For Each myReplErr In myMergeObj.ErrorRecords errString = errString & vbCrLf & myReplErr.Description Next MsgBox("The following replication error(s) occurred:" & vbCrLf & errString) Else MsgBox("The following system exception has occurred:" & vbCrLf & ex.ToString()) End If Finally cmdSync.Enabled = True cmdCancel.Enabled = False cmdClose.Enabled = True BarSyncProgress.Value = 0 End Try End Sub Private Sub cmdSync_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSync.Click AddHandler myMergeObj.Status, New _SQLMergeEvents_StatusEventHandler(AddressOf myMergeObj_Status) Call Me.SyncronizeSreverReplication() End Sub Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click MyBase.Close() End Sub 'This block of code is never execute '*********************************************** Private Sub myMergeObj_Status(ByVal message As String, _ ByVal percent As Integer, _ ByRef retCode As STATUS_RETURN_CODE) _ Handles myMergeObj.Status Me.lblStatus.Text = message Me.BarSyncProgress.Value = percent If blnCancel Then retCode = STATUS_RETURN_CODE.CANCEL strMessage = message Application.DoEvents() End Sub '*********************************************** Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click blnCancel = True End Sub End Class |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > VB.NET ActiveX Replication , block of code does not execute |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|