1
Answer

C# Replication

Photo of prabha

prabha

13y
2.6k
1
Hi ,

 I am doing the replication programatically. It is working fine. But while adding the filter in the replication ,I have the following issue "You must return snapshot,because the snapshot are obsolete".I used the merge pull replication .For the filter i used the following code.

 MergeArticle crewArticle = new MergeArticle();
                    string articleName = "tblAttendance";
                    // Set the required properties for the tblAttendance article.
                    crewArticle.ConnectionContext = publisherConnection;
                    crewArticle.Name = articleName;
                    crewArticle.DatabaseName = publisherConnection.DatabaseName;
                    crewArticle.SourceObjectName = articleName;
                    //crewArticle.SourceObjectOwner = hrSchema;
                    crewArticle.PublicationName = publicationName;
                    crewArticle.Type = ArticleOptions.TableBased;

                    // Define the parameterized filter clause based on Hostname.
                    crewArticle.FilterClause ="CrewID="+ mergePullSubscription.HostName;

                    if (!crewArticle.IsExistingObject) crewArticle.Create();



Thanks
Prabha




Answers (1)

0
Photo of Suthish Nair
NA 31.7k 4.6m 13y
You need to rerun the snapshot agent to create up to date snapshot files.