Submitted by
kine on Saturday, May 29, 2010 - 17:49.
Hello Sir.
I have difficulty writting out the code to reset user password in the database after login into the application.
Here is my code
char[] oldPass = jPasswordField1.getPassword();
String strOldPass = new String(oldPass);
char[] newPass = jPasswordField2.getPassword();
String strNewPass = new String(newPass);
char[] confPass = jPasswordField3.getPassword();
String strConfPass = new String(confPass);
try
{
Inventory objInven = new Inventory();//creating of the objectof the connection in class Inventory.
Statement stmt = objinven.con.createStatement();
ResultSet rs = stmt.getResult();
while(rs.next())
{
if(rs.getsring("Password").equals(strOldPass))
{
rs.moveToInserRow();
rs.updateString("Password", strNewPass);
rs.updateString("Password", strConfPass);
if(strNewPass.equals(strConfPass))
{
JOptionPane.showMessageDialog(this, "Password change successfuly");
}
else
{JOptionPane.showMessageDialog(this, "Password do not match");
}
}
else
{
JOptionPane.showMessageDialog(this, "Wrong old Password");
}
}
catch(SQLException ex)
{
ex.printStackTrace();
}
}
this code is to be performed when a submit button is clicked.
i have this error : Exception occurred during event dispatching: jana.lang.NullPointerException.
please help me out with this code that will allow users to change their old password to a new one in the database created by correcting my error
Thanx