Package com.mysql.jdbc

Examples of com.mysql.jdbc.PreparedStatement.executeUpdate()


      preStat.setString(4, utilisateur.getPrenom());
      preStat.setInt(5, utilisateur.getSolde());
      preStat.setString(6, utilisateur.getMotDePasse());

      int id = -1;
      preStat.executeUpdate(preStat.asSql(),
          preStat.RETURN_GENERATED_KEYS);
      // Les id auto-générées sont retournées sous forme de ResultSet
      ResultSet ids = preStat.getGeneratedKeys();
      if (ids.next()) {
        id = (int) ((long) ids.getObject(1));
View Full Code Here


    try {
      PreparedStatement preStat = (PreparedStatement) connex
          .prepareStatement(select);
      preStat.setInt(1, somme);
      preStat.setString(2, utilisateur.getPseudo());
      preStat.executeUpdate();
    } catch (SQLException ignore) {
      System.out.println("erreur updateSolde : " + ignore);
    }
    closeConnection(connex);
  }
View Full Code Here

      PreparedStatement preStat = (PreparedStatement) connex
          .prepareStatement(delete);
     
    for (Utilisateur u : list) {
      preStat.setInt(1, u.getId());     
      preStat.executeUpdate()
    }

   
    } catch (SQLException ignore) {
      System.out.println("erreur tous utilisateur: " + ignore);
View Full Code Here

      preStat.setLong(2, v.getDate());
      preStat.setInt(3, v.getPrix());
      preStat.setInt(4, v.getIdClient());
      preStat.setString(5, v.getType());
     
      preStat.executeUpdate(preStat.asSql(),preStat.RETURN_GENERATED_KEYS);
      //Les id auto-générées sont retournées sous forme de ResultSet
      ResultSet ids = preStat.getGeneratedKeys();
      if(ids.next()){
        id = (int)((long)ids.getObject(1))
      }
View Full Code Here

    connex = getConnection();
    String insert = "INSERT INTO `bon`(`id`) VALUES (?)";
    try {
      PreparedStatement preStat = (PreparedStatement) connex.prepareStatement(insert);   
      preStat.setInt(1, b.getId());
      preStat.executeUpdate();
    }catch (SQLException ignore) {     
      System.out.println("erreur ajouterBon : " + ignore);
    }
    closeConnection(connex);
  }
View Full Code Here

      preStat.setLong(2, b.getDateU());
      preStat.setString(3, b.getType());
      preStat.setInt(4, b.getIdClientU());
      preStat.setInt(5, b.getUtilise());
      preStat.setInt(6, b.getId());
      preStat.executeUpdate();
    } catch (SQLException ignore) {     
      System.out.println("erreur updateBon : " + ignore);
    }
    closeConnection(connex);
  }
View Full Code Here

      ps.setString(4, quantityTextField.getText());
      ps.setString(5, descriptionTextArea_1.getText());
      ps.setInt(6, categoryMap.get(CategorycomboBox.getSelectedItem()));
      System.out.println(ps);
      try{
        ps.executeUpdate();
      }catch(SQLException e){
        JOptionPane.showMessageDialog(null, "Please insert price and quantity properly",null, 0);
      }
     
     
View Full Code Here

      ps.setString(3, priceTextField.getText());
      ps.setString(4, quantityTextField.getText());
      ps.setString(5, descriptionTextArea_1.getText());
      ps.setInt(6, categoryMap.get(CategorycomboBox.getSelectedItem()));
      System.out.println(ps);
      ps.executeUpdate();
      showResult();
      // conn.close();

    } catch (SQLException e) {
      e.printStackTrace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.