![]() ![]() ![]() ![]() |
|||||
|
|||||
樓主 z~~~~~ ![]()
![]() |
小弟建了一個products.mdb的資料庫,若不設條件而全部列出時,在分頁rs.pagecount(即有關第一頁,上一頁,下一頁,最終頁)的程式都沒問題,可是若是以表單來下條件, 第一頁顯示也都正常,也計算出合乎條件者有幾筆,幾頁, 可是一旦按了"下一頁"時,顯示的就會變成全列出,而非符合條件者, 不解...請網友們指教,感激不盡!!
本篇文章發表於2002-08-02 13:56
|
1樓 |
你在按下一頁的時候有沒有把查詢條件也送出呀...
本篇文章回覆於2002-08-02 14:06
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
2樓
作者回應
z~~~~~ ![]() |
程式碼如下:
<!--#include file="common.asp"--> '建立connection物件 <% data1=request("keyword") sql="select * from products where name like '" & "%" & data1 & "%" & "'" rs.open sql,conn,1,3 myself=request.servervariables("path_info") %> <% if rs.eof then response.write "沒有您要的資料" response.end end if %> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=big5"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>您查詢的結果如下:</p> <table width="549" cellspacing="0" cellpadding="5" border="1" bordercolor="#0000FF"> <tr> <td width="52"><font size="2">編號</font></td> <td width="129"><font size="2">型號</font></td> <td width="199"><font size="2">品名</font></td> <td width="157"><font size="2">類別</font></td> </tr> <% page = Clng(request("page")) if page < 1 then page = 1 if page > rs.pagecount then page = rs.pagecount rs.pagesize = 20 rs.absolutepage = page for i = 1 to rs.pagesize %> <tr> <td width="52"><font size="2"><% =rs("編號") %></font></td> <td width="129"><font size="2"><% =rs("snumber") %></font></td> <td width="199"><font size="2"><% =rs("name") %></font></td> <td width="157"><font size="2"><% =rs("type") %></font></td> </tr> <% rs.movenext if rs.eof then exit for next %> </table> <p> </p> <form name="page" method="get" action="<%=myself%>"> <table width="555" cellspacing="2" cellpadding="0"> <tr> <td width="40"> <font size="2"> <% if page<>1 then response.write "<a href=""" & myself & "?page=1"">" & "第一頁" & "</a>" else response.write "第一頁" end if %> </font></td> <td width="41"> <font size="2"> <% if page<>1 then response.write "<a href=""" & myself & "?page= " & (page-1) & """>" & "上一頁" & "</a>" else response.write "上一頁" end if %> </font></td> <td width="49"> <font size="2"> <% if page<>rs.pagecount then response.write "<a href=""" & myself & "?page= " & (page+1) & """>" & "下一頁" & "</a>" else response.write "下一頁" end if %> </font></td> <td width="158"> <font size="2"> <% if page<>rs.pagecount then response.write "<a href=""" & myself & "?page= " & rs.pagecount & """>" & "最終頁" & "</a>" else response.write "最終頁" end if %> </font></td> <td width="109"><font size="2">頁次<%=page%>/<%=rs.pagecount%></font></td> <td width="142"><font size="2">到第 <input type="text" size=3 style="border:1 solid #00000;height:20" name="page"> 頁 <input type="submit" name="submit" value="GO" style="border:1 solid #000000;height:20;background-color:#eeeeff"></font></td> </tr> </table> </form> </body> </html>
本篇文章回覆於2002-08-02 14:16
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
3樓 |
你用request("keyword")
但你的html一整頁都沒有keyword這東西 那下面這句會變成什麼情況,你總該知道了吧... select * from products where name like '" & "%" & data1 & "%" & "'
本篇文章回覆於2002-08-02 14:31
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
4樓
作者回應
z~~~~~ ![]() |
不好意思,我沒有提到.
另頁有一表單,即可提供查詢者輸入關鍵字<input type="text" name="keyword"...> 我想,如果這個沒有執行,怎可能跑我這張page哩... ^_^
本篇文章回覆於2002-08-02 14:55
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
5樓 |
....
那問你一件事 你上面貼的那頁.. 它的下一頁之上一頁是那一頁咧~(好像就是你上面貼的那一頁對吧....) 那它的下一頁之上一頁有keyword?
本篇文章回覆於2002-08-02 15:02
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
回覆 |
如要回應,請先登入. |