Monday, March 12, 2012

Is there merge monitor sample in vb.net?

Hello,

We are a vb.net shop and while some of us know a little C# it's not enough. Is there a sample solution for the monitoring of replication in vb.net? I know about the sales one but it's in c#. Thanks.

Please refer to the Books On line link

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/repref9/html/b323da02-fadf-443c-8ba7-0cc050250e2d.htm

which will point to every replication step through RMO programming and sample code is written in VB, C#, C++, J#, etc.

Thanks

|||

Yunjing,

Thanks for the response. Unfortunetly I am rather new to raiseevents. Is there a way someone could convert this to vb.net so I can try and understand it? I am basically looking for a progress bar and text output during the sync progress in vb.net as the SalesOrder sample does in c#. Here is what I have in vb.net but am not sure if it's correct. I also have an error when trying to call the agent.status. I got snippets from the salesorder sample c# solution

Public Delegate Sub SyncWhenConnectedStatus(ByVal sender As Object, ByVal eventArgs As StatusEventArgs)
Public Event Status As SyncWhenConnectedStatus

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
...other code...
Dim subscription As MergePullSubscription
Dim agent As MergeSynchronizationAgent
...other code...
agent.Status += New AgentCore.StatusEventHandler(AddressOf Sync_Status)

**cannot build

**Error 1 'Public Event Status(sender As Object, e As Microsoft.SqlServer.Replication.StatusEventArgs)' is an event, and cannot be called Directly. Use a 'RaiseEvent' statement to raise an event.

agent.Synchronize()
end sub

**Not sure if I am doing this correct either

Private Sub Sync_Status(ByVal sender As Object, ByVal e As StatusEventArgs)
' Update the Synchronization Status form.
txtOutput.AppendText(e.Message.ToString() + Environment.NewLine)

' Call the Status event to update the main form
' if sync when connected is used.
RaiseEvent Status(sender, e)
'If Not Status Is Nothing Then
' RaiseEvent Status(sender, e)
'End If
Application.DoEvents()
End Sub

No comments:

Post a Comment