业务逻辑层日志 的操作方法:
1, 添加 引用: System.Transactions;
2, 添加namespace using System.Transactions;
3, using (TransactionScope scope=new TransactionScope())
{
try
{
DataAccess.ExecuteNonQuery("update a set c='frank' where b=1");
if (rlt==true)
{
throw new Exception();
}
scope.Complete();//如果成功,则提交数据库,否则,会自动回滚!!!
Response.Write("success!");
}
catch
{
rlt=false;
}
}