首页 > Windows开发 > 详细

c#使用 TransactionScope事务导入数据例程

时间:2016-07-06 11:42:16      阅读:231      评论:0      收藏:0      [点我收藏+]

using System.Transactions;

try
{

using (TransactionScope scope = new TransactionScope())
{


var count = dc.ExecuteCommand(@"insert into bg_count_month(tj_month,emp_id,emp_name,count_month,count_day,money,dw)
select tj_month,emp_id,emp_name,count_month,count_day,money,dw from bg_count_month_import");
Lable_message.Text = "导入记录数:" + count;
dc.ExecuteCommand("delete from bg_count_month_import ");
scope.Complete();

}
GridView2.DataSourceID = "SqlDataSource1";
GridView2.DataBind();
Response.Write(MyUI.javascript_alert(Lable_message.Text));

}

catch (Exception e1)
{
Lable_message.Text = e1.Message;
Response.Write(MyUI.javascript_alert("错误:导入数据错误!"));
}

c#使用 TransactionScope事务导入数据例程

原文:http://www.cnblogs.com/shanwater/p/5646363.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!