Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String title = (String) titleCB.getSelectedItem();
- String name = nameTF.getText();
- String surname = surnameTF.getText();
- String year = (String) yearCB.getSelectedItem();
- String month = (String) monthCB.getSelectedItem();
- String day = (String) dayCB.getSelectedItem();
- String email = emailTF.getText();
- String password = new String(passwordPF.getText());
- Connection connection = null;
- Statement stmt = null;
- String email1 = emailTF.getText();
- String emailcon = emailconfirmTF.getText();
- if (emailcon.equals(email1)) {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- connection = DriverManager
- .getConnection("jdbc:mysql://localhost:3306/healthapp", "root", "");
- stmt = connection.createStatement();
- stmt.execute("INSERT INTO DOCTOR (DOCTOR_TITLE,DOCTOR_NAME,DOCTOR_SURNAME,DOCTOR_DOB,DOCTOR_EMAIL,DOCTOR_PASSWORD,DOCTOR_TELNUMBER,HOSPITAL_CODE) "
- + "VALUES ('" + title + "','" + name + "','" + surname + "','" + year + "-" + month + "-" + day + "','" + email + "','" + password + "','+353868728668','9')");
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- try {
- stmt.close();
- connection.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- LayoutManager layout = getParent().getLayout();
- if (layout instanceof CardLayout) {
- CardLayout cl = (CardLayout) layout;
- cl.show(getParent(), "WELCOME");
- }
- } else {
- JOptionPane.showMessageDialog(null, "emails do not match, please try again");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement