📄 employeedao.java~2~
字号:
package chapter25.db;
import java.sql.*;
public class EmployeeDAO
{
private Connection conn;
public EmployeeDAO(Connection conn) {
this.conn = conn;
}
public Employee findById(String id) throws SQLException
{
String sqlStr = "select * from employee where id ='"+id+"'";
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery(sqlStr);
if (rs.next()) {
return new Employee(id,rs.getString("name"),rs.getInt("age"));
}else{
return null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -