前两笔交易成功但第三笔交易失败

前两笔交易成功但第三笔交易失败

本文介绍了前两笔交易成功但第三笔交易失败,如何回滚操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发.net应用程序,其中要一次性执行三个操作.首先,将记录插入表中,然后将第一封邮件发送给admin,将第二封邮件发送给填写表单的用户..我不确定如何成功执行这三个操作.如果前两个操作已完成,而最后一个操作无法完成,则必须回滚.我正在考虑使用事务来执行此操作,并在任何操作未完成的情况下使用try catch异常回滚.但是我的疑问是,是否插入了记录并发送了第一封邮件,而在第二封邮件发送中发生了邮件发送失败,是第一封邮件发送回滚了 !!!

I am developing .net application where in three operations are to be performed at one go. At first, record is to be inserted into table, then first mail is to be send to admin and second mail is to be send to user who fills form.. I am not sure as to how can these three operations can be performed successfully. If first two operations are completed and last operation is not able to complete, then it must rollback. I am thinking of using transaction to do so and roll back using try catch exception if any of the operation is not complete. But my doubt is if record is inserted and first mail is send and mail send failure occurs in second mail send, is the first mail send rollbacked !!! is there another method to do so???

推荐答案



这篇关于前两笔交易成功但第三笔交易失败,如何回滚操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 21:13