简体   繁体   English

一笔交易中有两个连接

[英]Two connections under one Transaction

I searched araound and having some difficulties in implementing one scenario with SQL Server 2000 and sybase. 我搜索了araound,在使用SQL Server 2000和sybase实现一种方案时遇到了一些困难。

  1. I have two SQL servers on different locations naming ServerA (MSSQL Server) and ServerB (Sybase server). 我在不同位置有两个SQL Server,分别命名为ServerA(MSSQL Server)和ServerB(Sybase服务器)。

  2. I have a table called SALARY. 我有一张桌子叫SALARY。

  3. Whenever I insert one record to customer SALARY in ServerA, I also will insert it into ServerB. 每当我向ServerA中的客户SALARY插入一条记录时,我也会将其插入ServerB中。

  4. If should any of them failed, both of them should be rolled back. 如果它们中的任何一个失败,则都应回滚它们。

  5. I am using Asp .Net with VB for the programming. 我在VB中使用Asp .Net进行编程。

I do not have the right to change / add table in Server B. The only thing allowed in Server B is insert/delete/update record. 我无权更改/添加服务器B中的表。服务器B中唯一允许的是插入/删除/更新记录。

I looked around and find a method to use TransactionScope but I am not quite sure it is the right way to do. 我环顾四周,找到了一种使用TransactionScope的方法,但我不太确定这是正确的方法。

Ref: http://msdn.microsoft.com/zh-tw/library/system.transactions.transactionscope%28v=vs.80%29.aspx 参考: http : //msdn.microsoft.com/zh-tw/library/system.transactions.transactionscope%28v=vs.80%29.aspx

Please help. 请帮忙。 THANKS!!!! 谢谢!!!!

IMHO, TransactionScope is the right approach. 恕我直言,TransactionScope是正确的方法。 However, I'm unsure if Sybase supports the ability to enlist in ambient transactions. 但是,我不确定Sybase是否支持注册环境事务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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