Advertisement
Guest User

Untitled

a guest
Mar 9th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. String title = (String) titleCB.getSelectedItem();
  2. String name = nameTF.getText();
  3. String surname = surnameTF.getText();
  4. String year = (String) yearCB.getSelectedItem();
  5. String month = (String) monthCB.getSelectedItem();
  6. String day = (String) dayCB.getSelectedItem();
  7. String email = emailTF.getText();
  8. String password = new String(passwordPF.getText());
  9.  
  10. Connection connection = null;
  11. Statement stmt = null;
  12.  
  13. String email1 = emailTF.getText();
  14. String emailcon = emailconfirmTF.getText();
  15.  
  16. if (emailcon.equals(email1)) {
  17. try {
  18. Class.forName("com.mysql.jdbc.Driver");
  19. connection = DriverManager
  20. .getConnection("jdbc:mysql://localhost:3306/healthapp", "root", "");
  21.  
  22. stmt = connection.createStatement();
  23. stmt.execute("INSERT INTO DOCTOR (DOCTOR_TITLE,DOCTOR_NAME,DOCTOR_SURNAME,DOCTOR_DOB,DOCTOR_EMAIL,DOCTOR_PASSWORD,DOCTOR_TELNUMBER,HOSPITAL_CODE) "
  24. + "VALUES ('" + title + "','" + name + "','" + surname + "','" + year + "-" + month + "-" + day + "','" + email + "','" + password + "','+353868728668','9')");
  25. } catch (Exception e) {
  26. e.printStackTrace();
  27. } finally {
  28. try {
  29. stmt.close();
  30. connection.close();
  31. } catch (Exception e) {
  32. e.printStackTrace();
  33. }
  34. }
  35.  
  36. LayoutManager layout = getParent().getLayout();
  37. if (layout instanceof CardLayout) {
  38. CardLayout cl = (CardLayout) layout;
  39. cl.show(getParent(), "WELCOME");
  40. }
  41. } else {
  42. JOptionPane.showMessageDialog(null, "emails do not match, please try again");
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement