Good evening all dear.........
I am using this for copy a table data from one server to another server in sqlserver 2000.
I want this code execute in every 2 minute because source data updated in every 2 minutes and i need to copy new data in every 2 min. I try many but not sucess any, please help me its urgent, Thank you all.
namespace Test
{
public partial class Form1 : Form
{
public Form1()
{
SqlConnection source = new SqlConnection("Server = Rajan;User ID=abc;Password=123;Database=Test");
SqlConnection destination = new SqlConnection("Server = santosh;User ID=india;Password=12345;Database=Book");
SqlCommand cmd = new SqlCommand("delete from Book", destination);
source.Open();
destination.Open();
cmd.ExecuteNonQuery();
cmd = new SqlCommand("select * from Test", source);
SqlDataReader reader = cmd.ExecuteReader();
SqlBulkCopy bulkdata = new SqlBulkCopy(destination);
bulkdata.DestinationTableName = "Book";
bulkdata.WriteToServer(reader);
bulkdata.Close();
destination.Close();
source.Close();
InitializeComponent();
}
}
}