.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 1st, 2004, 12:17 AM
veasnamuch veasnamuch is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 veasnamuch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > VB.NET ActiveX Replication , block of code does not execute


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT