code_junkie

How do I transfer data from one database to another using a DataSet?

Nov 11th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. DataTable A = load table from A
  2. DataTable B = load table from B
  3.  
  4. foreach row in A
  5. col1 = row[col1]
  6. col2 = row[col2]
  7. matchRow = B.select( "col1 = " + col1 + " and col2 = " + col2)
  8. if not matchRow exists
  9. add new row to B with col1,col2
  10. end
  11. end
  12.  
  13. foreach row in B
  14. col1 = row[col1]
  15. col2 = row[col2]
  16. matchRow = A.select( "col1 = " + col1 + " and col2 = " + col2)
  17. if not matchRow exists
  18. remove row from B
  19. end
  20. end
  21.  
  22. update B
Add Comment
Please, Sign In to add comment