Example #1
0
 @Override
 public void modify(ServiceValue ssv) throws Exception {
   String sql = "UPDATE `carsell`.`service` SET `serdate`=?,`serstate`=?  WHERE `serid`=? ";
   Connection cn = null;
   try {
     cn = ConnectionFactory.getConnection();
     PreparedStatement ps = cn.prepareStatement(sql);
     ps.setString(1, ssv.getSerdate());
     ps.setString(2, ssv.getSerstate());
     ps.setInt(3, ssv.getSerid());
     ps.executeUpdate();
     ps.close();
   } catch (Exception e) {
     throw new Exception("服务DAO修改错误:" + e.getMessage());
   } finally {
     cn.close();
   }
 }
Example #2
0
 @Override
 public void add(ServiceValue ssv) throws Exception {
   String sql =
       "INSERT INTO `carsell`.`service`(`serid`,`serdate`,`serstate`,`clientid`) VALUES ( NULL,?,'预约',?)";
   Connection cn = null;
   try {
     cn = ConnectionFactory.getConnection();
     PreparedStatement ps = cn.prepareStatement(sql);
     ps.setString(1, ssv.getSerdate());
     ps.setInt(2, ssv.getClientid());
     ps.executeUpdate();
     ps.close();
   } catch (Exception e) {
     throw new Exception("服务DAO增加错误:" + e.getMessage());
   } finally {
     cn.close();
   }
 }