简体   繁体   中英

How to send data from a Sql Server to another Sql Server (Not Linked) Using C# ASP.NET HttpClient

I need to send data from one Database (Server A) to another Database (Server B) , on both server I have an ASP.NET application. I've searched about using a XML file with HttpClient Post. I don't want to use Web Service because i can't modify the Server B's application (I'll use an aspx file that already receive a xml from a Android App).

Any advice? If you can share some links about how can i do it i'll appreciate it :)

Thank you for your time, peace.

You don't have to use an XML for transferring data. You can use a C# ADO.Net or Entity Framework console or windows program or ASP.net website (with a button control) that will have the functionality to collect the data from one server and insert it in the other server.

Can't you generate a DataModel for Server B's backend using EntityFramework ? If you can connect to Server B's database, you can generate this from Visual Studio.

Once you have your Conceptual Model, you can use EntityFramework to add data to the other server.

eg

using(var db = new ServerBDatabaseContext())
{
   db.databaseTable.Add(someObjectFromDatabaseA);
   db.SaveChanges();
}

This video may help you accomplish what you're looking for https://msdn.microsoft.com/en-us/data/ff191186.aspx

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM