我都不知道怎么办才好!好象网上的人有说这样的问题 是少了 rs.next();但是我加上以后还是有错误,要不就是浏览不了下一页!请高手指点下!
告诉我这个 游标的定位怎样放,要放在那里,或是别的错误,指教了!
<%
String tiaojian="";
if(key!=null && !key.equals("")){
tiaojian=" where title like '%"+key+"%'";
}else{
tiaojian="";
}
if(od==null)
od="times";
if(od.equals("times")){
String sqltimes="select * from infos"+tiaojian+" order by times desc";
rtst=bt.getResultSet(sqltimes);
}else{
String sqlid="select * from infos"+tiaojian+" order by id desc";
rtst=bt.getResultSet(sqlid);
}
rtst.last();
recordCount=rtst.getRow();
// rtst.first();
maxPage=(recordCount%pagesize==0)?(recordCount/pagesize):(recordCount/pagesize+1);
if(pages==null){
pages="0";
}
pageNo=Integer.parseInt(pages);
if(pageNo<1){
pageNo=1;
}else{
if(pageNo>maxPage){
pageNo=maxPage;
}
}
%>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
<form name="form" method="post" action="houtai.jsp?op=61"> <tr>
<td width="252" height="40" align="center" ><font size="2">共<%=maxPage%>页,<%=recordCount%>条信息</font></td>
<td width="379" align="center">
<input name="keyword" type="text" size="20" maxlength="20">
<input type="submit" name="submit" value="查找"></td>
<td width="143" align="center"><font size="2">
<%=bt.pagelist(httpFile,pageNo,maxPage,str_parameter)%>
</font></td>
</tr> </form>
</table>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr align="center">
<td width="386" height="30">标题</td>
<td width="46">类型</td>
<td width="172"><a href="houtai.jsp?op=61&od=day">发布日期</a></td>
<td width="78"><a href="houtai.jsp?op=61&od=times">浏览次数</a></td>
<td width="90"> </td>
</tr>
<%
rtst.absolute((pageNo-1)*pagesize+1);
while(pagesize>0){
// int id=rtst.getInt("id");
// String title=rtst.getString("title");
// int fl=rtst.getInt("fenlei");
// Date date=rtst.getDate("date");
// int times=rtst.getInt("times");
// rtst.next();
if(rtst.next()){
%>
<tr bgcolor="#FFFFFF">
<td height="25"><%=rtst.getString("title")%></td>
<td align="center"><%=rtst.getInt("fenlei")%></td>
<td align="center"><%=rtst.getDate("date")%></td>
<td align="center"><%=rtst.getInt("times")%></td>
<td align="center"><a href="houtai.jsp?op=62&mod=<%=rtst.getInt("id")%>"><font size="2">修改</font></a> <a href="houtai.jsp?op=62&del=<%=rtst.getInt("id")%>"><font size="2">删除</font></a></td>
</tr>
<%
}
pagesize=pagesize-1;
try{
if(!rtst.next()){break;}
}catch(Exception e){e.printStackTrace();}
}%>
</table>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
<tr>
<td height="40" align="center" ><font size="2">当前第<%=pageNo+"/"+maxPage%>页,<%=recordCount%>条信息</font></td>
<td width="150" align="center"><font size="2">
<%=bt.pagelist(httpFile,pageNo,maxPage,str_parameter)%>
</font></td>
</tr>
</table>
告诉我这个 游标的定位怎样放,要放在那里,或是别的错误,指教了!
<%
String tiaojian="";
if(key!=null && !key.equals("")){
tiaojian=" where title like '%"+key+"%'";
}else{
tiaojian="";
}
if(od==null)
od="times";
if(od.equals("times")){
String sqltimes="select * from infos"+tiaojian+" order by times desc";
rtst=bt.getResultSet(sqltimes);
}else{
String sqlid="select * from infos"+tiaojian+" order by id desc";
rtst=bt.getResultSet(sqlid);
}
rtst.last();
recordCount=rtst.getRow();
// rtst.first();
maxPage=(recordCount%pagesize==0)?(recordCount/pagesize):(recordCount/pagesize+1);
if(pages==null){
pages="0";
}
pageNo=Integer.parseInt(pages);
if(pageNo<1){
pageNo=1;
}else{
if(pageNo>maxPage){
pageNo=maxPage;
}
}
%>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
<form name="form" method="post" action="houtai.jsp?op=61"> <tr>
<td width="252" height="40" align="center" ><font size="2">共<%=maxPage%>页,<%=recordCount%>条信息</font></td>
<td width="379" align="center">
<input name="keyword" type="text" size="20" maxlength="20">
<input type="submit" name="submit" value="查找"></td>
<td width="143" align="center"><font size="2">
<%=bt.pagelist(httpFile,pageNo,maxPage,str_parameter)%>
</font></td>
</tr> </form>
</table>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr align="center">
<td width="386" height="30">标题</td>
<td width="46">类型</td>
<td width="172"><a href="houtai.jsp?op=61&od=day">发布日期</a></td>
<td width="78"><a href="houtai.jsp?op=61&od=times">浏览次数</a></td>
<td width="90"> </td>
</tr>
<%
rtst.absolute((pageNo-1)*pagesize+1);
while(pagesize>0){
// int id=rtst.getInt("id");
// String title=rtst.getString("title");
// int fl=rtst.getInt("fenlei");
// Date date=rtst.getDate("date");
// int times=rtst.getInt("times");
// rtst.next();
if(rtst.next()){
%>
<tr bgcolor="#FFFFFF">
<td height="25"><%=rtst.getString("title")%></td>
<td align="center"><%=rtst.getInt("fenlei")%></td>
<td align="center"><%=rtst.getDate("date")%></td>
<td align="center"><%=rtst.getInt("times")%></td>
<td align="center"><a href="houtai.jsp?op=62&mod=<%=rtst.getInt("id")%>"><font size="2">修改</font></a> <a href="houtai.jsp?op=62&del=<%=rtst.getInt("id")%>"><font size="2">删除</font></a></td>
</tr>
<%
}
pagesize=pagesize-1;
try{
if(!rtst.next()){break;}
}catch(Exception e){e.printStackTrace();}
}%>
</table>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
<tr>
<td height="40" align="center" ><font size="2">当前第<%=pageNo+"/"+maxPage%>页,<%=recordCount%>条信息</font></td>
<td width="150" align="center"><font size="2">
<%=bt.pagelist(httpFile,pageNo,maxPage,str_parameter)%>
</font></td>
</tr>
</table>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货