c# 应用事务的简单实例
程序员文章站
2023-12-20 23:49:34
复制代码 代码如下:using (transactionscope tr = new transactionscope()) {  ...
复制代码 代码如下:
using (transactionscope tr = new transactionscope())
{
int i = this.deskmanager.addopendesk(account_c);
int j = this.deskmanager.updatedeskstatus(account_c.accountc_desk, "有客");
if (i > 0 && j > 0)
{
tr.complete();
}
else
{
messagebox.show("开桌未成功,与管理员联系!");
this.btnkz.enabled = false;
this.btndc.enabled = false;
this.btnchange.enabled = false;
this.button3.enabled = false;
}
tr.dispose();
}