[英]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. 我需要将数据从一个数据库(服务器A)发送到另一个数据库(服务器B) ,在这两个服务器上我都有一个ASP.NET应用程序。 I've searched about using a XML file with HttpClient Post. 我搜索了有关在HttpClient Post中使用XML文件的信息。 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). 我不想使用Web服务,因为我无法修改服务器B的应用程序(我将使用已经从Android应用程序接收xml的aspx文件)。
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. 您不必使用XML来传输数据。 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. 您可以使用C#ADO.Net或Entity Framework控制台或Windows程序或ASP.net网站(带有按钮控件),它们具有从一台服务器收集数据并将其插入另一台服务器的功能。
Can't you generate a DataModel
for Server B's backend using EntityFramework
? 您不能使用EntityFramework
为服务器B的后端生成DataModel
吗? If you can connect to Server B's database, you can generate this from Visual Studio. 如果可以连接到服务器B的数据库,则可以从Visual Studio生成此数据库。
Once you have your Conceptual Model, you can use EntityFramework
to add data to the other server. 一旦有了概念模型,就可以使用EntityFramework
将数据添加到其他服务器。
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 该视频可以帮助您完成所需的https://msdn.microsoft.com/zh-cn/data/ff191186.aspx
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.