Hi guys,
Hope this is question is OK as it's
vb.net and database related (although not in the book).
I wish to use replication in my app and so have gone into Access and created a Design Master and a Replica database. Now I want to programmatically synchronize the 2 tables (design master is copied to a local folder then synchronized with replica). Here's my code:
Private Function SynchronizeDBs(ByVal strReplicaName As String, ByVal strSynchWith As String, _
ByVal intSynchType As Integer, ByVal intSynchMode As Integer) As Boolean
Dim bSuccess As Boolean = True
Dim rep As New JRO.Replica
Try
rep.ActiveConnection = strReplicaName
rep.Synchronize(strSynchWith, intSynchType, intSynchMode)
Catch ex As Exception
MessageBox.Show(ex.Message & vbCr & vbLf & "Please Report This Message", "Synchronize Error")
bSuccess = False
Finally
rep = Nothing
End Try
Return bSuccess
End Function
and the calling function:
If SynchronizeDBsJRO(UPDATE_PATH, PROG_PATH, 2, 2) = True Then
' more code
End If
UPDATE_PATH and PROG_PATH are strings defining the design master and replica databases respectively.
Every time I run the programme I receive the following error message:
"Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another."
On debugging, the Try Catch traps the error on the assignment of the
rep.ActiveConnection = strReplicaName line.
Can anyone tell me what I'm doing wrong please?
Thanks,
ExDb