Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Partial replication using JRO

Status
Not open for further replies.

bytelogic

Programmer
Jun 12, 2006
3
AU
Hi, I have used the following microsoft code example:

Sub CreatePartial(strReplicableDBPath As String, _
StrDescription As String)
' This procedure creates a new, partial replica with global visibility.
' It assumes you are using the Northwind sample database, which contains
' the Customers table and the CustomersOrders relationship.

Dim repFull As New JRO.Replica
Dim repPartial As New JRO.Replica
Dim strPartialDBPath As String

strPartialDBPath = GetReplicaName(strReplicableDBPath, strDescription)

' Create partial replica.
repFull.ActiveConnection = strReplicableDBPath
repFull.CreateReplica strPartialDBPath, strDescription, _
jrRepTypePartial, jrRepVisibilityGlobal

Set repFull = Nothing

' Open the partial replica in exclusive mode and create an
' expression-based filter in the partial replica.
repPartial.ActiveConnection = "Data Source=" & strPartialDBPath _
& ";Mode=Share Exclusive"
repPartial.Filters.Append "Customers", jrFilterTypeTable, _
"Region = 'CA'"

' Create a filter based on a relationship in the partial replica.
repPartial.Filters.Append "Orders", jrFilterTypeRelationship, _
"CustomersOrders"

' Repopulate the partial replica based on the filters.
repPartial.PopulatePartial strReplicableDBPath

Set repPartial = Nothing
End Sub

I have a serious issue then trying to run the code in red. It states that the replica id already exists and this is onb first run.

Also, how do I create a relationship saying:

SELECT * FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID

so that only an order by the customers populated in the customer table is inserted.

I have done this as an easy example as the query I am actually doing will be a lot more complicated.

Does the relationships have to be set up for it to work or can you just do the relationship in the filter clause on the replication filter command????

Thanking you all in advance on this.

Kind Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top