?? moviedao.java
字號:
package com.mali.dao;
import java.util.*;
import java.sql.*;
import com.mali.beans.*;
public class MovieDAO {
public MovieDAO(){}
DBHelper dh = new DBHelper();
public ArrayList getOnePageMovie(int page){
ArrayList list = new ArrayList();
String sql = "select * from movieTbl where id between "+((page*4)-3)+" and "+page*4;
ResultSet rs = dh.executeQuery(sql);
try {
while(rs.next()){
Movie movie = new Movie(rs.getString(1),rs.getString(2));
list.add(movie);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
dh.closeCon();
}
return list;
}
public int getMovieCount(){
int res = 0;
String sql = "select count(*) from movieTbl";
ResultSet rs = dh.executeQuery(sql);
try {
rs.next();
res = rs.getInt(1);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
dh.closeCon();
}
return res;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -