如何在3层架构中实现sql事务。 [英] how to implement sql transaction in 3 tier architecture.

查看:70
本文介绍了如何在3层架构中实现sql事务。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想在我的三层体系结构中实现sql事务但不知道该怎么做。卡住了三天没看到任何例子我搜索过每一个地方。我的基本需求是我想在两个不同的表中保存记录。使用begin tran,commit并回滚trans.Any示例应该是首选的,提前谢谢。

Hi
i want to implement sql transactions in my three tier architecture but don't know how to do. stuck from three days not seen any example i searched every where. my Basic need is that i want to save records in two different tables. using begin tran, commit and roll back trans.Any example should be preferred Thanks in advance.

推荐答案

事务应该只在数据层实现,不包括业务层或天堂禁止其中的UI层。



SqlTransaction类 [ ^ ]
Transactions should only be implemented in the data layer, do not include business layers or heaven forbid UI layers in it.

SqlTransaction Class[^]


是。您可以在数据访问层中使用sqltransaction。



请参阅Code Project中的这篇文章,如果您仍需要任何帮助,请回复,我会相应地帮助您。



使用交易ADO.NET

Yes. You can use sqltransaction in your data access layer.

Please refer this article in Code Project and if you still need any help, please reply and I'll assist you accordingly.

Using Transactions in ADO.NET


这里有一些文章可以让您了解交易:

了解ADO中的事务和TransactionScope的初学者教程。 NET [ ^ ]

All About TransactionScope [ ^ ]

.NET应用程序中的事务 [ ^ ]



希望有所帮助。
Here are few articles which give you the idea about transactions:
A Beginner's Tutorial for Understanding Transactions and TransactionScope in ADO.NET[^]
All About TransactionScope[^]
Transaction in .NET Application[^]

Hope it helps.


这篇关于如何在3层架构中实现sql事务。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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