Click here to Skip to main content
15,559,544 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to synchronize my local system sql server database with online server .i try many method but failed could any body help me to synchronize the two database.
basically i want when i insert or update any data on my local database it automatically or after few minutes its automatically synchronized with online hosted sql database.
when im trying to do that code which i provide in below its giving an error which is

ex.Message = "Invalid object name 'test2_tracking'."


even test2_tacking is automatically created by self

What I have tried:

Imports Dotmim.Sync
Imports Dotmim.Sync.SqlServer

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim serverProvider As SqlSyncProvider = New SqlSyncProvider("Data Source=69.4.94.000;Initial Catalog=anydb;User Id=any;password=any")
        Dim clientProvider As SqlSyncProvider = New SqlSyncProvider("Data Source=DESKTOP-any;Initial Catalog=any;Integrated Security=True")

        Dim tables = New String() {"test2"}

        Dim agent As SyncAgent = New SyncAgent(clientProvider, serverProvider, tables)

        Try
            Dim s = Await agent.SynchronizeAsync()
            ListBox1.Items.Add(s)
        Catch ex As Exception
            Dim s = ex.Message
        End Try
        
    End Sub
End Class
Posted
Updated 17-Jun-19 0:25am
Comments
Naqash Younis 31-May-19 7:33am    
No Solution ????

1 solution

Seems you're using non-standard objects. I'd suggest to ask a question on proper GitHub: GitHub - Mimetis/Dotmim.Sync: A brand new database synchronization, multi platform, multi databases, developed on top of .Net Standard 2.0.[^]

For Microsoft specific database synchronization, please see: Database Synchronization with the Microsoft Sync Framework -- Visual Studio Magazine[^]. Note, that the Microsoft Sync Framework Developer Center | Microsoft Docs[^] is obsolete.

Because a database synchronization is the process of establishing data consistency between two or more databases (even if there's a one-way synchronization - from local to online database), you can choose few ways to implement it - via:
1. linked server[^] + stored procedures
Use a set of stored procedures which may help you to keep online data up to date. Create SP for every single CRUD operation. Inside of every sp add code to modify local and web database.
2. Linked server + Sql scheduled job(s)[^]
Use a job, which may be fired-up every half an hour, a day, etc.
3. SqlDependency class[^]
Use SQLDependency objects to inform final users about data changes.
4. SqlBulkCopy class[^]
Use SQLBulkCopy class for bulk load/copy data from off-line to on-line database.

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900