daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Jan 25th, 2016 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try {
  2.     String url = "jdbc:derby://localhost:1527/Members";
  3.     String username = "admin1";
  4.     String password = "admin1";
  5.  
  6.     Connection con = DriverManager.getConnection(url, username, password);
  7.     Statement stmt = con.createStatement();
  8.  
  9.     String query = "INSERT INTO BOOKING(MEMBERID, NAME, CONTACT, "
  10.             + "EMAILADDRESS, RESERVATIONDATE, RESERVATIONTIME) "
  11.             + "VALUES('"+txtMemberID.getText()+"', '"+txtName.getText()+"', "
  12.             + "'"+txtContact.getText()+"', '"+txtEmail.getText()+"', "
  13.             + "'"+comboDate.getDate()+"', '"+comboTime.getSelectedItem()+"')";
  14.  
  15.     stmt.execute(query);
  16.  
  17.     JOptionPane.showMessageDialog(null, "Booking created");
  18.  
  19.     txtMemberID.setText(null);
  20.     txtName.setText(null);
  21.     txtContact.setText(null);
  22.     txtEmail.setText(null);
  23.     comboDate.setDate(null);
  24.     comboTime.setSelectedItem("00");
  25.  
  26.     }
  27.     catch(SQLException ex) {
  28.         JOptionPane.showMessageDialog(null, ex.toString());
  29.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top