public void actionPerformed(ActionEvent e){ if(e.getSource().equals(save)) { //the save button try { // connection string Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/PizzaOrders"); Statement st = con.createStatement(); st.executeUpdate("insert into Register VALUES('" + CustomerID.getText() + "','" + fname.getText() + "','" + lname.getText() + "','" + telnum.getText() + "','" + city.getText() + "','" + zcode.getText() + "','" + status.getText() + "','" + creditcard.getText() + "','" + orderdate.getText() + "','" + deliveryfee.getText() + "'," + "'" + quantity.getText() + "','" + itemcost.getText() + "','" + TotalCost.getText() +"')"); JOptionPane.showConfirmDialog(null, "Orders saved!", "Result", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE); st.close(); con.close(); }catch(SQLException err){ err.printStackTrace(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)