- String insertRecordSql="select distinct depcity,arrcity,cabin,flightdate from TM_download where id>="+startId; DBConnection con=new DBConnection(); ResultSet record=con.executeQuery(insertRecordSql);
- con=null;
- con=new DBConnection();
- String cabin;
- String airline;
- String update;//="update TM_download set price=";
- try{
- while(record.next()){
- update="update TM_download set price=";
- cabin=record.getString("cabin");
- String depcity=record.getString("depcity");
- String arrcity=record.getString("arrcity");
- java.sql.Date flightdate=record.getDate("flightdate");
- airline=depcity+"-"+arrcity;
- Float cabinDisCoutF=(Float)cabinDiscount.get(cabin);
- Integer airlinePriceInt=(Integer)airlinePrice.get(airline);
- int cabinPrice=0;
- if(cabinDisCoutF!=null)
- cabinPrice=getCommonPrice(airlinePriceInt.intValue(),cabinDisCoutF.floatValue());
- else
- cabinPrice=getSpecialcabinPrice(cabin,flightdate);
- update=update+cabinPrice+" where cabin='"+cabin+"' and depcity='"+depcity+"' and arrcity='"+arrcity+"' and id>="+startId;
- con.executeUpdate(update);
- System.out.println("calculateCabinPrice sql:"+update);
- }
- }catch(SQLException sqle){
- sqle.printStackTrace();
- }finally{
- con.close();
- }
SQLException:Object has closed
最新推荐文章于 2021-03-25 23:02:29 发布