What you are trying to do is called Replication.
It is not a trivial subject, so I'm not even going to try to tell you what code to use - instead unfortunately, you will have to do some reading.
There is a tutorial on replication on MSDN:
SQL Server Replication[
^] This discusses it regarding SQL Server, but all of the principles and so forth are the same.