Compare commits
1 Commits
main
...
ModifyPass
| Author | SHA1 | Date |
|---|---|---|
|
|
3caafe2056 | 2 years ago |
@ -0,0 +1,27 @@
|
|||||||
|
package database;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class ModifyPassword {
|
||||||
|
public ModifyPassword() {
|
||||||
|
}
|
||||||
|
public static void modifypass(String user,String password) {
|
||||||
|
Connection con = ConnectDatabasemxq.connectDB();
|
||||||
|
|
||||||
|
PreparedStatement preSql;
|
||||||
|
|
||||||
|
String sqlStr = "update usertable set password=? where user = ?";
|
||||||
|
|
||||||
|
try {
|
||||||
|
preSql = con.prepareStatement(sqlStr);
|
||||||
|
preSql.setString(1, password);
|
||||||
|
preSql.setString(2, user);
|
||||||
|
int ok = preSql.executeUpdate();
|
||||||
|
|
||||||
|
con.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue