i want to create an application that can do syncronization (data transfer) between 2 SQL server (the dbstructure in each server are identical, lets say db1 and db2 for the database in these server). is there any method to compare the data stored in table in db1 and db2 (table1 and table2), and if different found in table2, then copy from table1 to table2.
i know that doing looping for these table and comparing each of the records can do this job, but it is very troublesome and ofcourse take a very long time.
and then i found out about dataset / datatable merge method, but i cannot actually get this method to work. is there anyone can help me with this datatable.merge methodology or any other better method to use.

i have already tried something like this:
VB Code:
  1. Private Function CopyData() As Boolean
  2.         Dim strSQL As String = ""
  3.         Dim sqladpData As System.Data.SqlClient.SqlDataAdapter
  4.         Dim dtSrc As System.Data.DataTable 'source data table
  5.         Dim dtDest As System.Data.DataTable 'destination data table
  6.         Dim dtChanges As System.Data.DataTable 'changes data table
  7.         Dim drChange As System.Data.DataRow
  8.         Dim dcPrimary(0) As System.Data.DataColumn
  9.         Dim sqlcbrUpdate As SqlClient.SqlCommandBuilder
  10.  
  11.         '---- Company ----
  12.         strSQL = "Select * From Company order by Code"
  13.         'source data
  14.         sqladpData = New System.Data.SqlClient.SqlDataAdapter(strSQL, g_objSrcConn)
  15.         dtSrc = New System.Data.DataTable
  16.         sqladpData.Fill(dtSrc)
  17.         'destination data
  18.         sqladpData = New System.Data.SqlClient.SqlDataAdapter(strSQL, g_objDestConn)
  19.         dtDest = New System.Data.DataTable
  20.         sqladpData.Fill(dtDest)
  21.         'setup primary keys
  22.         ReDim dcPrimary(0)
  23.         dcPrimary(0) = dtSrc.Columns(0)
  24.         dtSrc.PrimaryKey = dcPrimary
  25.         dcPrimary(0) = dtDest.Columns(0)
  26.         dtDest.PrimaryKey = dcPrimary
  27.  
  28.         'merge source & destination to get changes
  29.         dtDest.Merge(dtSrc, True, MissingSchemaAction.Ignore)
  30.     End Function
but i cannot update the merge result (newly added row from source) to the destination table in destination server