如何检查C#中是否正在进行交易? [英] How do i check whether a Transaction is in Progress in C#?

查看:73
本文介绍了如何检查C#中是否正在进行交易?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查C#中是否正在进行交易?

如果是这样,则下一个事务应在上一个事务完成之后执行.

在此先感谢.

How do I check whether a Transaction is in Progress in C#?

If so then the next transaction should be executed after the previous one is completed.

Thanks in Advance.

推荐答案

如果您使用的是System.Data.SqlClient.SqlTransaction,它将为您解决这些问题.尝试以下使用事务:

在ADO.NET中使用事务 [ http://www.c-sharpcorner.com/UploadFile/dchoksi/transaction02132007020042AM/transaction.aspx [ ^ ]

希望对您有所帮助:)
If you are using System.Data.SqlClient.SqlTransaction it will take care of these issues for you. Try these for Using Transaction:

Using Transactions in ADO.NET[^]

http://www.c-sharpcorner.com/UploadFile/dchoksi/transaction02132007020042AM/transaction.aspx[^]

hope it helps :)


您无需检查代码中的事务状态,只需创建事务即可,数据库服务器将处理它们.

如果在代码中开始新的事务之前等待每个事务完成,则会降低性能.

使用锁定页面等事务时,您应该注意一些事情.

请阅读以下有关事务隔离级别的信息: http://msdn.microsoft.com/zh-cn/library/ms173763.aspx [^ ]
You don''t need to check the transaction status in your code, just create your transactions and the DB server will handle them.

It will kill your performance if you wait for each transaction to finish before starting a new one in your code.

There are things you should be aware of when using transactions like locked pages etc.

Read the following on transaction isolation levels : http://msdn.microsoft.com/en-us/library/ms173763.aspx[^]


检查此链接
使用交易范围"实现隐式交易
Check this link
Implementing an Implicit Transaction using Transaction Scope


这篇关于如何检查C#中是否正在进行交易?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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