使用 System.Transactions 进行事物管理

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Transactions;
namespace DTcms.Web.aspx.main
{
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
bind();
} private void bind()
{
using (TransactionScope ts = new TransactionScope())
{
Model.user_login_log model = new Model.user_login_log();
model.user_id = ;
model.user_name="";
model.remark = Guid.NewGuid().ToString();
model.login_time=DateTime.Now;
model.login_ip=Request.UserHostAddress; new BLL.user_login_log().Add(model); new BLL.user_login_log().Add(model);
throw new Exception("aaaaaaaaaaaaaaaa");
ts.Complete();
Response.Write("ok");
} }
}
}
上一篇:电脑下载准考证需要什么应用程序


下一篇:Swift 中 insetBy(dx: CGFloat, dy: CGFloat) -> CGRect 用法详解