IDbHelper dbHelper = new OracleHelper(ConfigHelper.GetConfigString("BusinessDbConnection")); bool result = true; try { dbHelper.BeginTransaction(); //主表 TE_AREAManager manager = new TE_AREAManager(dbHelper, userInfo); TE_AREAEntity tE_AREAEntity = manager.GetObject(dbHelper.SqlSafe(eatxtAREA_ID)); manager.Delete(tE_AREAEntity); //子表 TE_AREA_SUBManager submanager = new TE_AREA_SUBManager(dbHelper, userInfo); TE_AREA_SUBEntity tE_AREA_SUBEntity = submanager.GetObject(dbHelper.SqlSafe(eatxtAREA_ID)); submanager.Delete(tE_AREA_SUBEntity); //执行SQL语句 string commandText = " DELETE FROM JINTIANDA WHERE ID=" + dbHelper.SqlSafe(id); dbHelper.ExecuteNonQuery(commandText); //事务提交 dbHelper.CommitTransaction(); } catch(Exception ex) { //事务回滚 dbHelper.RollbackTransaction(); result=false; } |