kmcbrearty
asked on
Can I use JRO with .Net?
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
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
ASKER
Sorry,
mnasman that really isn't helping me.
Kevin
mnasman that really isn't helping me.
Kevin
ASKER
mnasman,
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
Try
' Open connection
strDBConnection = "Provider=Microsoft.Jet.OL EDB.4.0;Da ta Source=" & strReplica1 & ";"
DBConnection = New ADODB.Connection
DBConnection.Open(strDBCon nection)
repReplica.ActiveConnectio n = DBConnection
' Sends changes made in each replica to the other.
repReplica.Synchronize(str Replica2, jrSyncTypeImpExp, jrSyncModeDirect)
repReplica = Nothing
MessageBox.Show("Synchroni zation Complete", "Synchronize Database", MessageBoxButtons.OK, MessageBoxIcon.Information )
Catch ex As Exception
MessageBox.Show(ex.Message , "An Error has Occured", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
DBConnection.Close()
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.
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
Try
' Open connection
strDBConnection = "Provider=Microsoft.Jet.OL
DBConnection = New ADODB.Connection
DBConnection.Open(strDBCon
repReplica.ActiveConnectio
' Sends changes made in each replica to the other.
repReplica.Synchronize(str
repReplica = Nothing
MessageBox.Show("Synchroni
Catch ex As Exception
MessageBox.Show(ex.Message
Finally
DBConnection.Close()
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.thecodeproject.com/cs/database/mdbcompact_latebind.asp