Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Can I use JRO with .Net?

Posted on 2005-03-23
Medium Priority
Last Modified: 2012-08-13
I have a replicated Access Database that I will need to be able to synchronize.  I know that Access using JRO to manage the synchronization.  Am I able to use JRO with .NET.  If not, can anyone point me in the right direction to find some material to explain how to handle the synchronization.

On a side note, what I am doing is rebuilding the frontend of the application to get it out of Access.  I don't necessarily have to use Access as a backend.  What I do have to do is make the data accessable on and off the network.  Most of the time it will be used in the office; however, the application will need to be able to run on several laptops at remote locations where they will not have access to the internet.  I will need to insure the data's integrity and have some way to synchronize the information when the laptops are back on the network.

Currently, I was looking for a solution that would keep the same backend.  If someone knows how to accomplish this using a different backend and can help me personally or point me to the information I will need to come up with a working solution I will also accept that.

Thank you,
Kevin McBrearty
Question by:kmcbrearty
  • 2
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 13621182
This article uses JRO to compact and repair Access, it may help you to accomplish what you are looking for

Author Comment

ID: 13746033

mnasman that really isn't helping me.


Author Comment

ID: 13952885

I have created code using VB.NET.  The following is the VB.NET code that was used and works.  

Imports System
Imports System.Windows.Forms
Imports JRO
Imports JRO.SyncTypeEnum
Imports JRO.SyncModeEnum

Module JROSync

    Function Synchronize(ByVal DB1 As String, ByVal DB2 As String)

        Call TwoWayDirectSync(DB1, DB2)

    End Function

    Sub TwoWayDirectSync(ByVal strReplica1 As String, _
    ByVal strReplica2 As String)
        Dim repReplica As New JRO.Replica
        Dim DBConnection As ADODB.Connection
        Dim strDBConnection As String

            ' Open connection
            strDBConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strReplica1 & ";"
            DBConnection = New ADODB.Connection

            repReplica.ActiveConnection = DBConnection

            ' Sends changes made in each replica to the other.
            repReplica.Synchronize(strReplica2, jrSyncTypeImpExp, jrSyncModeDirect)

            repReplica = Nothing
            MessageBox.Show("Synchronization Complete", "Synchronize Database", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "An Error has Occured", MessageBoxButtons.OK, MessageBoxIcon.Error)
            DBConnection = Nothing
        End Try

    End Sub

End Module

You have to add a reference to your project to the Microsoft Jet and Replication objects 2.6 library for it work.  If you want to rewrite this code for C# I will go ahead and award you the points.  Otherwise, I recommend that the points be refunded as the above link did not answer the question, it only works for compacting a database which is not what I wanted to accomplish.  I apologize for just now getting back to this but my wife was having some health problems and I haven't had much time to work on it.

Accepted Solution

PAQ_Man earned 0 total points
ID: 13972811
PAQed with points refunded (500)

Community Support Moderator

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question