<%
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
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<SCRIPT LANGUAGE=javascript>
<!--
function openwindow(url){
window.open(url,'','resizable=no,width=240,height=160,fullscreen=yes')
}
//-->
</SCRIPT>
<link rel="stylesheet" href="file:///F|/mysourceof17560/CSS.CSS" type="text/css">
</head>
<body bgcolor=#999999>
<p align="center">商品修改页面</p>
<table border="1" width="100%" cellpadding="0" cellspacing="0" bordercolordark="#999999" bordercolorlight="#000000">
<tr>
<td width="10%">
<div align="center">编号 </div>
</td>
<td width="63%">
<div align="center">商品名 </div>
</td>
<td width="14%">
<div align="center">主分类</div>
</td>
<td width="13%">
<div align="center">操作 </div>
</td>
</tr>
<%
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then '本条件判断是否到了尽头
exit for
end if
%>
<tr>
<td width="10%" align=center><%=rs("ID")%></td>
<td width="63%" align=center><%=rs("name")%> </td>
<td width="14%" align=center><%=rs("category_one")%> </td>
<td width="13%">
<div align="center">
<INPUT type="button" value="Button" id=button1 name=button1
ID")%>&zfenlei=<%=rs("category_one")%>','','resizable=no,width=240,height=160')">
</div>
</td>
</tr>
<%
currentRecord=currentRecord+1 '取的当前页的记录数
rs.MoveNext
next
rs.Close
%>
</table>
<div align="center" class="bfont">合计<%=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 %>
<a href="modifychart.asp?pageNum=1"> <font color="#FFFFFF">首页</font></a>
<%
else Response.Write "首页"
end if
if pageNum > 10 then
'如有需要,请在这里添上如果不足10页时该实现前n页的代码,
'请参考下面的如果后面不足10页时该怎么样处理的代码和思路
%>
<a href="modifychart.asp?pageNum=<%=(pageNum-10)%>"> <font color="#FFFFFF">前10页</font></a>
<%
end if
if (pageNum+10) < pagecuont then
'这里也相同参考下面的思路
%>
<a href="modifychart.asp?pageNum=<%=(pageNum+10)%>"> <font color="#FFFFFF">下10页</font></a>
<%
end if
if (pageNum+10) < pagecuont then
'这里判断后面是否还有10页
endpage=pageNum+9
else
endpage=pageCount
end if
for i=pageNum to endPage
%>
<a href="modifychart.asp?pageNum=<%=i%>">第<%=i%>页</a>
<%
next
if pageNum <> pageCount then
%>
<a href="modifychart.asp?pageNum=<%=pagecuont%>"> <font color="#FFFFFF">末页</font></a>
<%
end if
end if 'end of --->if pageCount >0 then
%>
</div>
</body>
</html>