I have a challenge I’ve been battling with for over a week now which is getting me frustrated.
I’m developing a project that has two parts; a web (ASP.NET) and a windows client (Winforms C#). Data is to be captured on the windows application and a windows service is supposed to schedule a transfer of records from the database on the local machine to a remote database. Creating the windows service is not a problem at all as I have created others in past projects to handle Email services and Short Message Service (SMS). But the code to handle the data transfer is the real problem here.
I’ve searched the internet for help but couldn’t find any that matches my requirement. Any help suggested here will be deeply appreciated.
Many Thanks y’all.
Kacey EzeriohaPosted Mar 26, 2014, 8:24 AM
Jignesh TrivediPosted Mar 26, 2014, 7:54 AM
hi,
I think you want transfer the data table by table between remote and local data base right?
In this case BCP feature can help you.
like
//fill you data set to local server..
DataSet ds = FillData();
//Create connetion for Remote Server...
SqlConnection sCon = new SqlConnection(@"Remote server data base connection string");
System.Data.SqlClient.SqlBulkCopy bc = new SqlBulkCopy(sCon);
bc.DestinationTableName = "Destination table Name";
sCon.Open();
bc.WriteToServer(ds.Tables[0]);
bc.Close();
sCon.Close();
hope this will help you.