You are on page 1of 3

String username, oldpass, newpass, confirmpass;

username= user_txt.getText();

oldpass = old_pass.getText();

newpass = new_pass.getText();

confirmpass = confirm_pass.getText();

String sql = "SELECT * FROM `login_information` WHERE username = '"+ username +"'";

String sqll = "UPDATE `login_information` SET `password`='"+ newpass +"' WHERE `username` = '"+
username +"'";

try{

// AirlineConnection.rs = AirlineConnection.stmt.executeQuery(sql);

if(rs.next())

if(rs.getString("password").equals(oldpass))

lbold.setText("");

if(newpass.equals(confirmpass))

lbconfirm.setText("");

ps.executeUpdate(sqll);

JOptionPane.showMessageDialog(this, "Password Change Successfully");

else

{
lbconfirm.setText("Confirm Password Does not Match");

confirm_pass.requestFocus();

else

lbold.setText("Invalid Old Password");

old_pass.requestFocus();

lbuser.setText("");

else

lbuser.setText("Invalid Username");

user_txt.requestFocus();

}catch(Exception e){

Aslkdjajsdasdkjasdjasd’akjs’dla’skdlasasdasdasdasdasdasdasdasdasdasdasd
if(newpass.equals(confirmpass))

lblconfirm.setText("");

JOptionPane.showMessageDialog(this, "Password Change Successfully");

else

lblconfirm.setText("Confirm Password Does not Match");

confirm_pass.requestFocus();

ps.executeUpdate(sqll);

You might also like