回 帖 发 新 帖 刷新版面

主题:【求助】高手近来看看

我写了段程序
<% Option Explicit %>
<!--#Include file="conn5.asp"-->
<html>
<head>
<title>LIST</title>
</head>
<body>
<h2 align="center">产品价格</h2>
<center>
<form method="post" action="">
<table bgcolor="#CCCCCC">
<tr>
   <td>产品名称关键字:</td><td><input type="text" name="ProductName" size="20"></td>
   <td><input type="submit" value="确 定"></td>
</tr>
</table>
</form>
<table border="1" width="90%">
<tr>
<td>ID</td>
<td>产品名称</td>
<td>类型</td>
<td>库存量</td>
<td >市场价</td>
<td bgcolor="#CCCCCC">商城价</td>
<td>会员价</td>
</tr>
<%
  if Trim(Request("ProductName"))<>"" then
   Dim sql,rs
   set rs=Server.CreateObject("ADODB.Recordset")
   sql="select ProductID,ProductName,ProductType,Stocks,Price_Market,Price_Original,Price_Member From Pe_product where ProductName like'%"&Trim(Request("ProductName"))&"%' "
   rs.Open sql,db,1,3
    If Not rs.Bof And Not rs.Eof Then
      dim page_size
      dim page_no
      dim page_total
      page_size=30
      If Request("page_no")="" then
        page_no=1
      else
        page_no=Cint(Request.QueryString("page_no"))
      End if
    rs.PageSize=page_size
    page_total=rs.PageCount
    rs.AbsolutePage=page_no
    dim I
    I=page_size
    Do while Not rs.EOF And I>0
    I=I-1
 %>
 <tr align="center">
<td width="30"><%=rs("ProductID")%></td>
<td align="left" width="400"><%=rs("ProductName")%></td>
<td width="50"><%=rs("ProductType")%></td>
<td width="70"><%=rs("Stocks")%></td>
<td width="70"><%=rs("Price_Market")%></td>
<td width="70" bgcolor="#CCCCCC"><%=rs("Price_Original")%></td>
 <td width="70"><%=rs("Price_Member")%></td>
</tr>
<%
    rs.MoveNext
    Loop
%>
 </table>
<%
    response.write"请选择页码:"
    for I=1 to page_total
        if I=page_no then
           response.write I & "&nbsp;"
        else
           response.write "<a href=list5.asp?page_no=" & I & ">" & I & "</a>&nbsp;"
        End if
    next
   End if
  End if
%>
 </center>
</body>
</html>

输入关键字后只能显示第一页的内容,点击第二页就不能显示了

回复列表 (共4个回复)

沙发

a href=list5.asp?page_no=" & I & ">" 
把ProductName也加在后面传递过去才可显示!

板凳

怎么写?

a href=list5.asp?page_no=" & I & name=ProductName">" 
还是?

3 楼

<a href=list5.asp?ProductName="&Trim(Request("ProductName"))&" page_no=" & I &   ">" & I & "</a>&nbsp;
这样写是可以了,但是不能显示是第几页

4 楼

错了,还是不能显示第二页的内容,而且搜索条里也不能在搜索了

我搜索1,点第3页,跟第一页显示的内容一样

URL里显示:http://127.0.0.1/list5.asp?ProductName=1&page_no=&3

我来回复

您尚未登录,请登录后再回复。点此登录或注册