Good day everyone, I'm trying to save an inputted data using JTextfield in JAVA GUI into MySQL database.
But when i pressed the save button nothing happens. I want to show you all my work right now.
Please try to help me, Thank you in advance!
But when i pressed the save button nothing happens. I want to show you all my work right now.
Please try to help me, Thank you in advance!
Code:
if(e.getSource().equals(save)) {
String ID=custid.getText();
int custid=Integer.parseInt(ID);
String fname=CustFName.getText();
String lname=CustLName.getText();
String tel=CustTelNum.getText();
String city=CustCity.getText();
String zcode=CustZCode.getText();
String status=CustStat.getText();
String creditcard=CreditCNum.getText();
String order=CustOrDt.getText();
String dfee=CustDFee.getText();
String inumber=MnuINum.getText();
String icost=MnuCost.getText();
String tcost=TotalCost.getText();
try {
rs.moveToInsertRow();
rs.updateInt(ID, custid);
rs.updateString("First_Name", fname);
rs.updateString("Last_Name", lname);
rs.updateString("Tel_Num", tel);
rs.updateString("City", city);
rs.updateString("Zip_Code", zcode);
rs.updateString("Status", status);
rs.updateString("Credit_Card", creditcard);
rs.updateString("Order_Date", order);
rs.updateString("Delivery", dfee);
rs.updateString("Quantity", inumber);
rs.updateString("Item_Cost", icost);
rs.updateString("Total_Cost", tcost);
rs.insertRow();
st.executeQuery("INSERT INTO thepizzadb.orderstable VALUES (ID,'fname','lname','tel'","'city','zcode','status','creditcard','order','dfee','inumber','icost','tcost')");
st.close();
rs.close();
}catch(SQLException err){
JOptionPane.showMessageDialog(null, err.getMessage());
}
}
Comment