如何使用c#在两个不同的服务器上进行MySQL事务 [英] How to do MySQL Transaction over two different servers with c#

查看:87
本文介绍了如何使用c#在两个不同的服务器上进行MySQL事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在c#中创建一个winform应用程序。我需要在两个 不同的服务器 上的两个不同的数据库中更新/插入或删除两个不同的表,我想要用事务做(如果一个数据库中的更新失败,另一个数据库将被回滚。)



我该怎么做,请在c#中给出一些代码还说明了在两个不同的服务器上进行mysql事务是否合适(我的意思是,有些机会因为我在某些论坛中读到这个数据库会因为分布式事务的执行不当而被破坏)。



我在互联网上搜索但我找不到c#代码。



谢谢

I am making a winform application in c#. I need to update/insert or delete two different tables in two different databases on two different servers and I want to do it with transaction (If update in one database fails, the other will be rolled back.)

How can I do it, please give some code in c# and also state whether it is good to do mysql transaction over two different servers (I mean, is there any chances that database will get corrupted by poor implementation of distributed transaction as I read this in some forum).

I searched over internet but I could not find c# code.

Thank you

推荐答案

你可以尝试在SQL中分布式事务功能,通过链接m不确定它将帮助你的范围



https://redmondmag.com/articles/2014/02/27/ sql-server-distributed-transactions.aspx [ ^ ]
can you try distributed transaction functionality in SQL kindly go through the link m not sure up to what extend it was going to help you

https://redmondmag.com/articles/2014/02/27/sql-server-distributed-transactions.aspx[^]


这篇关于如何使用c#在两个不同的服务器上进行MySQL事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆