Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > BOOK: Beginning VB.NET Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 27th, 2007, 09:14 AM
Authorized User
 
Join Date: Jan 2006
Location: , , .
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


Reply With Quote
  #2 (permalink)  
Old August 28th, 2007, 04:53 AM
Authorized User
 
Join Date: Jan 2006
Location: , , .
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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 05:59 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.