Hi Guys,
I am getting an error:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "jLabel4"
With this code:
public void insertCustomer() {
Properties conProps = new Properties();
conProps.setProperty("user", "user");
conProps.setProperty("password", "pass");
int q = Integer.parseInt(jLabel4.getText());
try {
con = DriverManager.getConnection("jdbc:mysql://91.208.99.2:3379/5thfloor_pos", conProps);
con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
} catch (SQLException ex) {
Logger.getLogger(AddProduct.class.getName()).log(Level.SEVERE, null, ex);
}
String sql = ("INSERT INTO order_prty(customer, barcode, total) VALUES (?,?, ?)");
try {
con.setAutoCommit(false);
st = (com.mysql.jdbc.PreparedStatement) con.prepareStatement(sql);
st.setString(1, customer.getSelectedItem().toString());
st.setString(2, jTextField3.getText().toString());
st.setInt(3,q);
st.execute();
st.close();
con.commit();
// JOptionPane.showMessageDialog(null, "saved!");
} catch (Exception se) {
se.printStackTrace();
}
}
Any ideas?