📄 changepwddao.java
字号:
package com.yiboit.cfss;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import com.yiboit.cfss.db.ManageConnection;
public class ChangePwdDAO {
public boolean savePwd(String userName, String pwd) throws SQLException {
boolean result = false;
Connection conn = null;
try {
conn = ManageConnection.getConnection();
String sql = "update shop_user set password = ? "
+ " where username = ? ";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, pwd);
pstmt.setString(2, userName);
result = pstmt.executeUpdate() == 1 ? true : false;
} catch (SQLException e) {
e.printStackTrace();
throw e;
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
}
}
}
return result;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -