★<% setcon=server.Cre...... <% set con=server.CreateObject("ADODB.Connection") strConnection="Data Source=xxxxxxx;" con.Open strConnection set rs = Server.CreateObject("ADODB.Recordset") chartSQL="select ID,name,category_one from goods " rs.Open chartSQL,con,1,3 if rs.EOF or rs.BOF then '如果为空 response.end end if pagesize=10 '每页显示10条记录 pagecuont=rs.PageCount '总页数 recordcount=rs.RecordCount dim pagenum '当前页码 dim currentRecord '当前页的记录数,对于末页其值不等于pagesize if Request.QueryString ("pageNum")="" then pageNum=1 else pageNum=Request.QueryString ("pageNum") rs.AbsolutePage =trim(Request.QueryString ("pageNum")) end if %> 商品修改页面
合计<%=recordCount%> 条记录 | 第 <% pageNum_record=(pageNum-1)*pageSize+1 '初始记录位置 pageNum_record_=pageNum_record+currentRecord-1 '末记录位置 Response.Write pageNum_record %> -<%=pageNum_record_%>条 | 第<%=pageNum%>页 |共<%=pagecuont%>页 <% if pagecuont >0 then '防止当前返回的为空记录,即数据库中该数据集为空 if pageNum > 1 then %> 首页 <% else Response.Write "首页" end if if pageNum > 10 then '如有需要,请在这里添上如果不足10页时该实现前n页的代码, '请参考下面的如果后面不足10页时该怎么样处理的代码和思路 %> 前10页 <% end if if (pageNum+10) < pagecuont then '这里也相同参考下面的思路 %> 下10页 <% end if if (pageNum+10) < pagecuont then '这里判断后面是否还有10页 endpage=pageNum+9 else endpage=pageCount end if for i=pageNum to endPage %> 第<%=i%>页 <% next if pageNum <> pageCount then %> 末页 <% end if end if 'end of --->if pageCount >0 then %> |
|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )
GMT+8, 2024-9-30 21:24 , Processed in 0.154064 second(s), 12 queries , Gzip On, MemCache On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.