2 回答
TA贡献1846条经验 获得超7个赞
public List<UserBean> getUsersByPage(int pageNow)
{
List<UserBean> al=new ArrayList<UserBean>();
try
{
ct=new ConnDB().getConn();
rs=sm.executeQuery("select top "+pageSize+" * from users where userId not in(select top "+pageSize*(pageNow-1)+" userId from users) " );
while(rs.next())
{
UserBean ub=new UserBean();
ub.setUserId(rs.getInt(1));
ub.setUserName(rs.getString(2));
ub.setPasswd(rs.getString(3));
ub.setEmail(rs.getString(4));
ub.setGrade(rs.getInt(5));
al.add(ub);
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
this.close();
}
return al;
}
TA贡献1794条经验 获得超8个赞
ArrayList<UserBean> al=new ArrayList<UserBean>();
改成 如下
List<UserBean> al = new ArrayList<UserBean>();
添加回答
举报