我正在尝试将用户密码插入MySQL数据库,当我尝试通过重复密码确认密码时,两个密码彼此不相同,所以我无法插入密码:
password = new JPasswordField();
repeatPassword = new JPasswordField();
(...)
char[] passwdValue=password.getPassword();
char[] passwdRepeatValue=repeatPassword.getPassword();
(...)
if (usernameValue!=null && passwdValue!=null
&& passwdValue==passwdRepeatValue // error! e.g.: '1234' != '1234'
&& emailValue!=null
&& nameValue!=null && lastNameValue!=null){
(...)
String sqlQuery="INSERT INTO `db`.`users` (`username`, `password`, `email`,
`name`, `lastname`, `bornday`) " + "VALUES ('" + usernameValue + "', '" +
passwdValue + "', '" + emailValue + "', '" + nameValue + "', '" +
lastNameValue + "', '" + yearValue + "-" + monthOrder + "-" + dayValue + "');";
(...)
}
你能帮帮我吗?非常感谢你:))