c# 应用事务的简单实例

复制代码 代码如下:

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();
 }

你可能感兴趣的:(c# 应用事务的简单实例)