在线等待:哪位大哥帮我看看这一段程序(关于分页)。 你现在数据库中的数据共2页吧!再多加点数据,第2页也应该不正常!如果我没看错的话do{}while(rs.next())中间没有限定语句,一直到结尾了。 如果采用do{}while应该中间加跳转语句。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 错误发生在下面的代码中:rs.absolute(currindex);if(totalpage==0) currpage=0;do{ int id=rs.getInt(1); String title=rs.getString(2); String author=rs.getString(4); Date postime=rs.getDate(5);%> <tr bgcolor="#ccccff"> <td height="30"><font color="#0000ff"><b><%=id%></b></font></td> <td height="30"><font color="#0000ff"><b><%=title%></b></font></td> <td height="30"><font color="#0000ff"><b> <%=author%></b></font></td> <td height="30"><font color="#0000ff"><b> <%=postime%></b></font></td> </tr> <tr bgcolor="#ffffff" align="left" valign="top"> <td><font color="#0000ff"></font></td> </tr><% }while(rs.next());你开始把游标定位在currindex rs.absolute(currindex);是对的但你没有给出结束行,应该每页都要给出一个结束,即每页都有开始行与结束行,显示的内容为从开始行到结束行。 int nCount = 0;//添加内容do{ nCount++;//添加内容 int id=rs.getInt(1); String title=rs.getString(2); String author=rs.getString(4); Date postime=rs.getDate(5);%> <tr bgcolor="#ccccff"> <td height="30"><font color="#0000ff"><b><%=id%></b></font></td> <td height="30"><font color="#0000ff"><b><%=title%></b></font></td> <td height="30"><font color="#0000ff"><b> <%=author%></b></font></td> <td height="30"><font color="#0000ff"><b> <%=postime%></b></font></td> </tr> <tr bgcolor="#ffffff" align="left" valign="top"> <td><font color="#0000ff"></font></td> </tr><%}while(rs.next()&&nCount<10);//添加内容 马上进客服现场开发,求过来人给点意见。 时间字段到期后自动删除 各位兄弟姐妹,江湖救急呀,帮帮兄弟吧。 急救啊!怎样同时实现两个线程? 如何解决新增一行记录慢的问题 100分 如何得到此<input type="text" name="aa">的值 有经验的高手请帮忙解疑难:asp和jsp能否共同开发一个项目?不胜感激! Jbuilder和jsp的问题?(散分) 请问如何自动获取request来的数据中所有域的域名和值 如何在Win2K中配置IIS+Resin? 调用function函数没有反应 关于IE上的back的问题
rs.absolute(currindex);
if(totalpage==0)
currpage=0;
do{
int id=rs.getInt(1);
String title=rs.getString(2);
String author=rs.getString(4);
Date postime=rs.getDate(5);%>
<tr bgcolor="#ccccff">
<td height="30"><font color="#0000ff"><b><%=id%></b></font></td>
<td height="30"><font color="#0000ff"><b><%=title%></b></font></td>
<td height="30"><font color="#0000ff"><b> <%=author%></b></font></td>
<td height="30"><font color="#0000ff"><b> <%=postime%></b></font></td>
</tr>
<tr bgcolor="#ffffff" align="left" valign="top">
<td><font color="#0000ff"></font></td>
</tr>
<%
}while(rs.next());
你开始把游标定位在currindex rs.absolute(currindex);是对的
但你没有给出结束行,应该每页都要给出一个结束,即每页都有开始行与结束行,显示的内容为从开始行到结束行。
do{
nCount++;//添加内容 int id=rs.getInt(1);
String title=rs.getString(2);
String author=rs.getString(4);
Date postime=rs.getDate(5);%>
<tr bgcolor="#ccccff">
<td height="30"><font color="#0000ff"><b><%=id%></b></font></td>
<td height="30"><font color="#0000ff"><b><%=title%></b></font></td>
<td height="30"><font color="#0000ff"><b> <%=author%></b></font></td>
<td height="30"><font color="#0000ff"><b> <%=postime%></b></font></td>
</tr>
<tr bgcolor="#ffffff" align="left" valign="top">
<td><font color="#0000ff"></font></td>
</tr>
<%}while(rs.next()&&nCount<10);//添加内容