Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- String url = "jdbc:derby://localhost:1527/Members";
- String username = "admin1";
- String password = "admin1";
- Connection con = DriverManager.getConnection(url, username, password);
- Statement stmt = con.createStatement();
- String query = "INSERT INTO BOOKING(MEMBERID, NAME, CONTACT, "
- + "EMAILADDRESS, RESERVATIONDATE, RESERVATIONTIME) "
- + "VALUES('"+txtMemberID.getText()+"', '"+txtName.getText()+"', "
- + "'"+txtContact.getText()+"', '"+txtEmail.getText()+"', "
- + "'"+comboDate.getDate()+"', '"+comboTime.getSelectedItem()+"')";
- stmt.execute(query);
- JOptionPane.showMessageDialog(null, "Booking created");
- txtMemberID.setText(null);
- txtName.setText(null);
- txtContact.setText(null);
- txtEmail.setText(null);
- comboDate.setDate(null);
- comboTime.setSelectedItem("00");
- }
- catch(SQLException ex) {
- JOptionPane.showMessageDialog(null, ex.toString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement