📄 product.asp
字号:
<!-- #include file="opendb.inc" -->
<!-- #include file="adovbs.inc" -->
<html>
<head>
<title>货物列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%
Set Conn=Server.CreateObject("ADODB.Connection")
Set Rs=Server.CreateObject("ADODB.RecordSet")
Conn.Open(sqlOpenDB) '打开数据库
Rs.Open "Select ProductID,Name,Unit,UnitPrice From Product",Conn,adOpenStatic
Rs.PageSize=10
If Request.QueryString("Move")="" Then Session("CurrentPage")=1
If Request.QueryString("Move")="first" Then Session("CurrentPage")=1
If Request.QueryString("Move")="pre" Then Session("CurrentPage")=Session("CurrentPage")-1
If Request.QueryString("Move")="next" Then Session("CurrentPage")=Session("CurrentPage")+1
If Request.QueryString("Move")="last" Then Session("CurrentPage")=Rs.PageCount
If Request.Form.Count>0 Then Session("CurrentPage")=Request.Form("Page")
Rs.AbsolutePage=Session("CurrentPage")
%>
<div align="center">
<form name="form" method="post" action="search.asp">
输入您要查询的商品:
<input type="text" name="Search" size="20" maxlength="20">
<input type="submit" name="Submit" value="搜索">
</form>
<p><H2><font face="华文彩云">货物列表</font></H2> </p>
<p><form name="formPage" method="post" action="product.asp">
<%If Session("CurrentPage")>1 Then%>
<A HREF="product.asp?move=first">首页</A> <%Else%>首页 <%End If%>
<%If Session("CurrentPage")>1 Then%>
<A HREF="product.asp?move=pre">上一页</A> <%Else%>上一页 <%End If%>
<%If Session("CurrentPage")<Rs.PageCount Then%>
<A HREF="product.asp?move=next">下一页</A> <%Else%>下一页<%End If%>
<%If Session("CurrentPage")<Rs.PageCount Then%>
<A HREF="product.asp?move=last">末页</A> <%Else%>末页 <%End If%>
第
<input type="text" name="Page" size="4" maxlength="4" value=<%=Session("CurrentPage")%>>
页
<input type="submit" name="Submit" value="跳转">
<%=Session("CurrentPage")%>/<%=Rs.PageCount%>
</form></p>
<table width="500" border="1" cellspacing="0">
<tr bgcolor="#CCCCCC">
<td nowrap width="85">
<div align="center"><b>货物代号</b></div>
</td>
<td nowrap width="190">
<div align="center"><b>货物名称</b></div>
</td>
<td nowrap width="45">
<div align="center"><b>单位</b></div>
</td>
<td nowrap width="61">
<div align="center"><b>单价</b></div>
</td>
</tr>
<%
While Not Rs.Eof And Rows<Rs.PageSize
%>
<tr>
<td width="85">
<div align="center"><%=rs("ProductID")%></div>
</td>
<td width="190">
<div align="center"><A HREF="pro_detail.asp?proID=<%=rs("ProductID")%>"><%=rs("Name")%></A></div>
<!-- 点击跳转到货物介绍页面 -->
</td>
<td width="45">
<div align="center"><%=rs("Unit")%></div>
</td>
<td width="61">
<div align="center"><%=FormatCurrency(rs("UnitPrice"))%></div>
</td>
</tr>
<%
Rs.MoveNext
Rows=Rows+1
Wend
%>
</table>
<p><form name="formPage" method="post" action="product.asp">
<%If Session("CurrentPage")>1 Then%>
<a href="product.asp?move=first">首页</a> <%Else%>首页 <%End If%>
<%If Session("CurrentPage")>1 Then%>
<a href="product.asp?move=pre">上一页</a> <%Else%>上一页 <%End If%>
<%If Session("CurrentPage")<Rs.PageCount Then%>
<a href="product.asp?move=next">下一页</a> <%Else%>下一页<%End If%>
<%If Session("CurrentPage")<Rs.PageCount Then%>
<a href="product.asp?move=last">末页</a> <%Else%>末页 <%End If%>
第
<input type="text" name="Page" size="4" maxlength="4" value=<%=Session("CurrentPage")%>>
页
<input type="submit" name="Submit" value="跳转">
<%=Session("CurrentPage")%>/<%=Rs.PageCount%>
</form></p>
</div>
<%
Rs.Close
Set Rs=Nothing
Conn.Close
Set Conn=Nothing
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -