Please help me. This code no error shows, but when it's run and finished it show error.
This is my code:
private void jBtn_UpdateActionPerformed(java.awt.event.ActionEvent evt {
String user_id = txt_UserID.getText();
String cur_pass = txt_CurrentPassword.getText();
String new_pass = txt_NewPassword.getText();
try{
Connection c = DBConnection.dbconmethod();
Statement s = c.createStatement();
ResultSet rs = s.executeQuery("SELECT * from admin_data");
while(rs.next()){
String userid = rs.getString("user_id");
String pass = rs.getString("password");
if(user_id.equals(userid) && cur_pass.equals(pass)){
s.executeUpdate("UPDATE admin_data SET password='"+new_pass+"'");
UIManager.put("OptionPane.messageFont", new Font("Monospaced", Font.BOLD, 22));
JOptionPane.showMessageDialog(new view.AdminPrivacy(), "Password Succesfully Changed!", null, JOptionPane.INFORMATION_MESSAGE);
txt_UserID.setText(null);
txt_CurrentPassword.setText(null);
txt_NewPassword.setText(null);
}else{
UIManager.put("OptionPane.messageFont", new Font("Monospaced", Font.BOLD, 22));
JOptionPane.showMessageDialog(new view.AdminPrivacy(), "Error : Invalid Data.", "Error Message", JOptionPane.ERROR_MESSAGE);
}
c.close();
s.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
This is error: https://i.stack.imgur.com/8COxh.png