示例#1
0
  @Override
  public boolean Update(EM em) {
    // TODO 自动生成的方法存根
    Connection conn = null;
    try {
      conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/softcal", "root", "");

      PreparedStatement ppsm =
          conn.prepareStatement(
              "UPDATE em_info SET CPLX=?,TIME=?,PVOL=?,"
                  + "PCON=?,APEX=?,LTEX=?,SITE=?,RELY=?,DOCU=?,"
                  + "STOR=?,ACAP=?,PCAP=?,TOOL=?,SCED=?,PLEX=?,InputEm=? WHERE proj_id=? AND version_id=? AND type=?");
      ppsm.setFloat(1, em.getCPLX());
      ppsm.setFloat(2, em.getTIME());
      ppsm.setFloat(3, em.getPVOL());
      ppsm.setFloat(4, em.getPCON());
      ppsm.setFloat(5, em.getAPEX());
      ppsm.setFloat(6, em.getLTEX());
      ppsm.setFloat(7, em.getSITE());
      ppsm.setFloat(8, em.getRELY());
      ppsm.setFloat(9, em.getDOCU());
      ppsm.setFloat(10, em.getSTOR());
      ppsm.setFloat(11, em.getACAP());
      ppsm.setFloat(12, em.getPCAP());
      ppsm.setFloat(13, em.getTOOL());
      ppsm.setFloat(14, em.getSCED());
      ppsm.setFloat(15, em.getPLEX());
      ppsm.setFloat(16, em.getInputEm());
      ppsm.setInt(17, em.getProj_id());
      ppsm.setInt(18, em.getVersion_id());
      ppsm.setInt(19, em.getType());
      System.out.println(ppsm.toString());
      ppsm.executeUpdate();
      ppsm.close();
      return true;
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } finally {
      try {
        conn.close();
      } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    return false;
  }
示例#2
0
 @Override
 public void Save(EM em) {
   // TODO 自动生成的方法存根
   Connection conn = null;
   try {
     conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/softcal", "root", "");
     PreparedStatement ppsm =
         conn.prepareStatement(
             "insert into em_info (proj_id,version_id,CPLX, "
                 + "TIME,PVOL ,PCON ,APEX ,LTEX ,SITE ,RELY ,DOCU ,STOR ,ACAP ,PCAP ,PLEX ,"
                 + "TOOL ,SCED,InputEm,type) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
     ppsm.setInt(1, em.getProj_id());
     ppsm.setInt(2, em.getVersion_id());
     ppsm.setFloat(3, em.getCPLX());
     ppsm.setFloat(4, em.getTIME());
     ppsm.setFloat(5, em.getPVOL());
     ppsm.setFloat(6, em.getPCON());
     ppsm.setFloat(7, em.getAPEX());
     ppsm.setFloat(8, em.getLTEX());
     ppsm.setFloat(9, em.getSITE());
     ppsm.setFloat(10, em.getRELY());
     ppsm.setFloat(11, em.getDOCU());
     ppsm.setFloat(12, em.getSTOR());
     ppsm.setFloat(13, em.getACAP());
     ppsm.setFloat(14, em.getPCAP());
     ppsm.setFloat(15, em.getPLEX());
     ppsm.setFloat(16, em.getTOOL());
     ppsm.setFloat(17, em.getSCED());
     ppsm.setFloat(18, em.getInputEm());
     ppsm.setInt(19, em.getType());
     ppsm.execute();
     ppsm.close();
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } finally {
     try {
       conn.close();
     } catch (SQLException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
 }