---------------------------------------------------------------------------------------------2011-12-14编辑-------------------------------------------------------------------------------------------------------------------
using (OracleConnection oc = new OracleConnection(OracleHelper.ConnectionString))
{
oc.Open();
OracleTransaction trans = oc.BeginTransaction();//申明一个基于连接的事物并开始执行
try
{
Dtsc.Common.Upload.UploadHelper.DeleteResFile(model.ActivityId);
BizTsNeactivitys.Delete(model.ActivityId,trans);
trans.Commit();//提交事物
flg = true;
}
catch (Exception ex)
{
trans.Rollback();//回滚事物
flg = false;
throw ex;
}
finally
{
trans.Dispose();
}
return flg;
}
写个方法,返回类型是bool ,调用该方法
实际使用修改Dtsc.Common.Upload.UploadHelper.DeleteResFile(model.ActivityId); BizTsNeactivitys.Delete(model.ActivityId,trans);这2句就可以了。
例如:
public bool t_spSWJZ(TsNeactivitys model)
{
bool flg = false;
using (OracleConnection oc = new OracleConnection(OracleHelper.ConnectionString))
{
oc.Open();
OracleTransaction trans = oc.BeginTransaction();//申明一个基于连接的事物并开始执行
try
{
Dtsc.Common.Upload.UploadHelper.DeleteResFile(model.ActivityId);
BizTsNeactivitys.Delete(model.ActivityId,trans);
trans.Commit();//提交事物
flg = true;
}
catch (Exception ex)
{
trans.Rollback();//回滚事物
flg = false;
throw ex;
}
finally
{
trans.Dispose();
}
return flg;
}
}