手机
当前位置:查字典教程网 >编程开发 >C#教程 >winfrom 在业务层实现事务控制的小例子
winfrom 在业务层实现事务控制的小例子
摘要:复制代码代码如下:try{using(TransactionScopetr=newTransactionScope()){inti=this...

复制代码 代码如下:

try

{

using (TransactionScope tr = new TransactionScope())

{

int i = this.customermanager.addCustomer(customer);

int j = this.homestatusmanager.updateHomestatus(homestatus);

if ((i * j) > 0)

{

MessageBox.Show("记录插入成功!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);

Empty();

tr.Complete();

}

else

{

MessageBox.Show("记录插入失败!联系管理员!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);

Empty();

}

tr.Dispose();

}

}

catch(Exception err)

{

MessageBox.Show("记录插入失败" +err.ToString(), "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);

}

【winfrom 在业务层实现事务控制的小例子】相关文章:

winform调用javascript的小例子

c# 开机启动项的小例子

WinForm中的登录实现

C#实现类似qq的屏幕截图程序

C#之IP地址和整数互转的小例子

C#简单获取时间差的小例子

winform树形菜单无限级分类实例

winform中写app.config文件时调试情况下没有改变的原因

c# winform多线程的小例子

WinForm DataGridView控件隔行变色的小例子

精品推荐
分类导航