Wrox Programmer Forums
|
BOOK: Beginning VB.NET Databases
This is the forum to discuss the Wrox book Beginning VB.NET Databases by Thearon Willis; ISBN: 9780764568008
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 27th, 2007, 08:14 AM
Authorized User
 
Join Date: Jan 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default JRO Replication Error

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


 
Old August 28th, 2007, 03:53 AM
Authorized User
 
Join Date: Jan 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

After searching high and low, I've managed to sort out the problem myself.

Apparently the current version of ADO is out of sync (pardon the pun) with COM, therefore you have to use the method:

let_ActiveConnection(object)

instead of:

ActiveConnection()

See the following article:

http://support.microsoft.com/kb/308499


The modified code is below (in bold):

Try
    rep.let_ActiveConnection(strReplicaName)
    rep.Synchronize(strSynchWith, intSynchType, intSynchMode)
Catch ex As Exception





Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge Replication using Web Sync Error wangjt18 SQL Server 2005 1 May 6th, 2008 04:54 AM
Q about Replication D.A.D Java Databases 0 June 1st, 2007 02:14 AM
Replication happygv SQL Server 2000 3 April 26th, 2007 08:52 AM
Replication Error melvik SQL Server 2000 0 May 29th, 2005 09:27 AM
Replication KellyM955 SQL Server 2000 2 February 21st, 2005 11:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.