Hi there,
I hope somebody has an answer for this issue. I'm fairly
new to VFP. I'm using VFP8 to automate Sql replication
using sqldmo, sql snapshot and merge activex controls.
The snapshot and the merge controls have an Event called
Status. This event returns progress messages and status
from the Sql server as those controls doing their work.
The issue I'm having is that the Status Event Does not
fire at all. So I'm left in the dark at what the SQL
server is doing. I couldn't find any hints on the
internet that could help. If you have any ideas, please
let me know.
Thanks.
If you want to try it, I assembled a little code that
would do that. You first need to configure the SQL server
for publication and put the code below on the click event
of a command button.
LOCAL SrvrObject
LOCAL oReplicationDb
LOCAL oDatabase
LOCAL oArticle
LOCAL oMergePublication
SrvrObject = CREATEOBJECT("SqLDMO.Sqlserver2")
With SrvrObject
.LoginTimeout = -1
.LoginSecure = .T.
.AutoReConnect = .F.
.Connect ("ComputerName")
ENDWITH
*Enable merge replication for the Northwind database
oReplicationDb =
SrvrObject.Replication.ReplicationDatabases("Northwind")
oReplicationDb.EnableMergePublishing = .T.
*Create a Merge Publication
oMergePublication = CREATEOBJECT
("SQLDMO.MergePublication2")
*Set the publication properties
WITH oMergePublication
.Name = "Northwind"
.Description = "Merge publication."
.SnapshotMethod = 8
&&SQLDMOInitSync_BCPNative
.PublicationAttributes = 1
&&SQLDMOPubAttrib_AllowPush
.CentralizedConflicts = .T.
.SnapshotSchedule.FrequencyType = 1 &&
SQLDMOFreq_OneTime 'Execute snapshot agent only one time
.SnapshotSchedule.ActiveStartDate = 0
.SnapshotSchedule.ActiveEndDate = 99991231
.RetentionPeriod = 180
ENDWITH
*Add the publication to the database
oReplicationDb.MergePublications.Add
(oMergePublication)
WITH oArticle
.Name = "Products"
.ArticleType = 10
&&SQLDMORep_TableBased
.ColumnTracking = .T.
.SourceObjectName = "Products"
.AllowInteractiveResolver = .F.
ENDWITH
*Add Article
oMergePublication.MergeArticles.Add (oArticle)
RELEASE oArticle
oArticle.Name = "employees"
oArticle.ArticleType = SQLDMORep_TableBased
oArticle.ColumnTracking = True
oArticle.SourceObjectName = "employees"
oArticle.AllowInteractiveResolver = False
*Add Article
oMergePublication.MergeArticles.Add (oArticle)
*Start the snapshot
With thisform.SQLSnapshot1
.Publisher = ("ComputerName")
.PublisherDatabase = "Northwind"
.Distributor = ("ComputerName")
.Publication = "Northwind"
.DistributorSecurityMode = 1
.PublisherSecurityMode = 1
.ReplicationType = 2 &&MERGE
.Initialize
.Run
.Terminate
ENDWITH