📄 stuinfomanager.java
字号:
/*
* 创建日期 2006-3-12
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
package cn.edu.bit.business;
import java.util.*;
import cn.edu.bit.data.DataQuery;
import cn.edu.bit.object.StuInfo;
import java.sql.*;
/**
* @author sun
*
* TODO 要更改此生成的类型注释的模板,请转至 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class StuInfoManager {
public ArrayList getStuInfo(String min, String max) {
ArrayList al = new ArrayList();
String queryStr = "select * from score where score >=" + min
+ " and score<=" + max + " order by score asc";
DataQuery dq = new DataQuery();
try {
Connection con = dq.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(queryStr);
while (rs.next()) {
String no = rs.getString("StuNo");
String name =rs.getString("StuName");
double score = rs.getDouble("Score");
StuInfo si = new StuInfo(no,name,score);
al.add(si);
}
rs.close();
stmt.close();
con.close();
} catch (Exception e) {
e.printStackTrace();
}
return al;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -