一些基础的关于java jdbc的程序代码
count = y / 5 + 1;
}
if (i < count) {
x = ((++i) - 1) * 5;
String sql = "select top "
+ x
+ " * from (select * from bbc where name not in(select top " + x + " name from bbc order by name)) as A ";
list = query(sql);
} else if (i >= count) {
list = null;
}
return list;
}
public static int queryCount() {
int count = 0;
Connection conn = DBConnection.getConnection();
String sql = "select count(*) from bbc";
Statement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
count = rs.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return count;
}
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库Java连接数据库增删改查(12)在线全文阅读。
相关推荐: