SQLDMO and replication

SQLDMO and replication

Post by Francisc Molna » Wed, 29 Jan 2003 21:45:23



Can anyone give me a link to some examples( or some sample code) on how to
"start sycronizing" a merge replication agent using SQLDMO ?
 Thanks

 
 
 

SQLDMO and replication

Post by Michael McPhea » Thu, 30 Jan 2003 12:45:20


Try something like the following to start the Merge Agent on demand.

Dim objJob As SQLDMO.Job
Dim objQryResult As SQLDMO.QueryResults
Dim sMergeJobID As String

    sMergeJobID =
objServer.Replication.ReplicationDatabases(sSubscriberDB).MergePullSubscript
ions(1).MergeJobID
    Set objJob = objServer.JobServer.GetJobByID(sMergeJobID)

    'SQLDMOJobExecution_Idle=4
    'SQLDMOJobExecution_Executing=1

    If objJob.CurrentRunStatus <> SQLDMOJobExecution_Executing Then
        objJob.Invoke
    End If

Regards,

Mike


Quote:> Can anyone give me a link to some examples( or some sample code) on how to
> "start sycronizing" a merge replication agent using SQLDMO ?
>  Thanks


 
 
 

SQLDMO and replication

Post by Francisc Molna » Thu, 30 Jan 2003 22:48:00


The code you sent works fine, thanks.
By executing this in a try-catch (VB.Net), I assume I can display the
errors--if any.
Now let's say that syncronization is done. How can I get some information
about the conflicts (at least the names of the tables with conflicting
records) ?
Is this information stored on the subscriber or on the publisher? This is
important to me because in  my application syncronization will occur once a
day, or by demand. Anyway, I would like to offer to the end user some kind
of "conflict log"(or at least a list with the conflicts occured when the
last Sync has run).


Quote:> Try something like the following to start the Merge Agent on demand.

> Dim objJob As SQLDMO.Job
> Dim objQryResult As SQLDMO.QueryResults
> Dim sMergeJobID As String

>     sMergeJobID =

objServer.Replication.ReplicationDatabases(sSubscriberDB).MergePullSubscript
> ions(1).MergeJobID
>     Set objJob = objServer.JobServer.GetJobByID(sMergeJobID)

>     'SQLDMOJobExecution_Idle=4
>     'SQLDMOJobExecution_Executing=1

>     If objJob.CurrentRunStatus <> SQLDMOJobExecution_Executing Then
>         objJob.Invoke
>     End If

> Regards,

> Mike



> > Can anyone give me a link to some examples( or some sample code) on how
to
> > "start sycronizing" a merge replication agent using SQLDMO ?
> >  Thanks

 
 
 

1. SQLDMO - Merge Replication

Hello,

I'm setting up a merge replication between MSDE and a full SQLServer. I wish
to start a synchronisation from within my VB-application using SQLDMO.

I purchased the book  'Professional SQL Server 7.0 using SQL-DMO, SQL-NS &
DTS' of Rachelle Reese and Frank miller but unfortunately did not find any
samples of really starting a predifined/pre-scripted merge-replication.

I'm looking for a few number of code-lines in VB to access the SQLDMO-object
that should do a 'synchronise now'. Did anyone of you wrote these allready ?
Their even should be a way of using a progressbar to show the status of the
replication. Once I bought the book, this seemed not to be handled in the
book.

Can anyone help me with some lines of code ?

Thank you,
Olivier

2. Setting highlight of radio button in character mode

3. Replication out of control and SQLDMO....

4. Linked Server Oracle

5. Pulling Transactional Replication thru SQLDMO

6. Views vs. Stored Proc

7. replication from 6,5 to 7(SQLDMO error)

8. Reporting replication status using SQLDMO

9. ambigous version error while SQLDMO-Replication

10. SQLDMO replication

11. SQLDMO 2k compability with sqldmo 7

12. Client-Side SQLDMO Programming in VB - Can't register SQLDMO.DLL for SQL2K