Groups | Blog | Home
all groups > sql server programming > october 2003 >

sql server programming : Using SQL Server Distribution ActiveX control with C#


a_farnsy NO[at]SPAM yahoo.com
10/8/2003 10:55:58 PM
I am trying to use the SQL Server Distribution ActiveX control in
Visual C# to trigger the replication of a snapshot that has already
been created at the publisher.

The replication is working correctly, but the "status" event is not
triggered. I have attached an event handler, but it never appears to
be called.

I have read somewhere that there is an issue with the control in that
the status event doesn't seem to work correctly - is this the case?

I don't wish to generate the snapshot, simply replicate it.

I have also found that even when I call the run method in a different
thread, it doesn't appear to run correctly in that thread - i.e. the
controlling ui loses any control.

Has anyone successfully used the snapshot control with C#, and used
the status event?

johnston NO[at]SPAM mounet.com
10/9/2003 12:45:21 PM
To implement the Status event in a managed-code environment such as
C#.NET, you need to be running SQL Server 2000 Service Pack 3 (SP3).
To use the Status event, you need to declare myMergeObj at the module
level by using the WithEvents keyword. This routine returns a SUCCESS
code to the Merge control. Calling the DoEvents method updates the
progress bar. Note that you need a handler for the Status event ...
AddHandler myMergeObj.Status, New
_SQLMergeEvents_StatusEventHandler(AddressOf _
myMergeObj_Status)

V/R Jim Johnston
MCSD.NET, MCDBA


[quoted text, click to view]
AddThis Social Bookmark Button