Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JButton create = new JButton("Create Account");
- create.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- String nom = Field_nom.getText();
- String prenom = Field_prenom.getText();
- String ddn = Field_ddn.getText();
- String login = Field_login.getText();
- @SuppressWarnings("deprecation")
- String mdp = Field_password.getText();
- //String mdp_conf = Field_password2.getText();
- String mail = Field_mail.getText();
- Connection con=null;
- java.sql.PreparedStatement ps = null;
- try {
- Class.forName("com.mysql.jdbc.Driver");
- con = DriverManager.getConnection("jdbc:mysql://localhost/puissance_quatre", "root", "1234");
- ps = con.prepareStatement("insert into joueur (nom,prenom,nom_utilisateur,mot_de_passe,adresse_mail,date_naissance) values (?,?,?,?,?,?)");
- //ps.setInt (1, id_joueur);
- System.out.println("nom :"+nom+"::");
- ps.setString(1, nom);
- ps.setString(2, prenom);
- ps.setString(3, login);
- ps.setString(4, mdp);
- ps.setString(5, mail);
- ps.setString(6, ddn);
- int i = ps.executeUpdate();
- if (i>0){
- JOptionPane.showMessageDialog(null, "joueur enregistré !!!!");
- }
- else {
- JOptionPane.showMessageDialog(null, "Problème de connexion ! ");
- }
- }catch(Exception er) {
- JOptionPane.showMessageDialog(null, er);
- }
- }
- });
- create.setBounds(200, 321, 123, 23);
- frame.getContentPane().add(create);
- JButton exit = new JButton("Exit");
- exit.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- new EcranDemarrage();
- frame.setVisible(false);
- frame.dispose();
- }
- });
- exit.setBounds(341, 321, 123, 23);
- frame.getContentPane().add(exit);
- Field_password = new JPasswordField();
- Field_password.setBounds(235, 160, 180, 20);
- frame.getContentPane().add(Field_password);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement