C # using TransactionScope transactions to import data routines

Source: Internet
Author: User

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 = "Number of imported records:" + 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 ("Error: Import data Error! "));
}

C # using TransactionScope transactions to import data routines

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.