I have the following code to update a record. The code compiles however it skips everything in the try statement and displays the error message in the catch statement. I am not sure what it is that I am missing as it doesn't display any sort of syntax error.
try {
PreparedStatement st = db.con.prepareStatement("UPDATE item SET Name = ?, Size = ?, Price = ?, WHERE ItemCode = ?");
st.setString(1, textArea_Code.getText());
st.setString(2, textArea_name.getText());
st.setString(3, textArea_size.getText());
st.setString(4, textArea_price.getText());
st.executeUpdate();
JOptionPane.showMessageDialog(frame, "Updated");
} catch (SQLException e ) {
JOptionPane.showMessageDialog(frame, "update not successful");
}