rsearch.asp
上传用户:syzzy1975
上传日期:2022-07-17
资源大小:670k
文件大小:8k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
  2. <%
  3. %><!--#include file="manage/inc/config.asp"--> 
  4. <!--#include file="inc/conn.asp"--> 
  5. <%
  6. if request.QueryString="" then 
  7. call MsgBox("错误:没有搜索条件!","GoUrl","search.asp")
  8. response.end
  9. end if
  10. '开始分页
  11. Const MaxPerPage=5
  12. dim totalPut   
  13. dim CurrentPage
  14. dim TotalPages
  15. dim j
  16. dim sql
  17. dim nid,sortsid
  18. if Not isempty(request.QueryString("page")) then
  19. currentPage=Cint(request.QueryString("page"))
  20. else
  21. currentPage=1
  22. end if 
  23. set rs=server.CreateObject("adodb.recordset")
  24. dim name
  25. dim author
  26. dim manufacturer
  27. dim enabledate
  28. dim expiredate
  29. dim smallprice
  30. dim largeprice
  31. dim code
  32. dim OrderField
  33. dim Order
  34. name=trim(request.QueryString("name"))
  35. author=trim(request.QueryString("author"))
  36. manufacturer=trim(request.QueryString("manufacturer"))
  37. enabledate=trim(request.QueryString("enabledate"))
  38. expiredate=trim(request.QueryString("expiredate"))
  39. smallprice=trim(request.QueryString("smallprice"))
  40. largeprice=trim(request.QueryString("largeprice"))
  41. OrderField=trim(request.QueryString("OrderField"))
  42. Order=trim(request.QueryString("Order"))
  43. code=trim(request.QueryString("code"))
  44. if OrderField="" then OrderField="adddate"
  45. if Order="" then Order="DESC"
  46. sql="select pagenum,name,mark,vipprice,id,author,productdate,price2,price1,discount,pic from product where 1=1 "
  47. if name<>"" then
  48. sql=sql&"and name like '%"&name&"%' "
  49. end if
  50. if author<>"" then
  51. sql=sql&"and author like '%"&author&"%' "
  52. end if
  53. if manufacturer<>"" then
  54. sql=sql&"and mark like '%"&manufacturer&"%' "
  55. end if
  56. if code<>"" then
  57. sql=sql&"and categoryid like '%"&code&"%' "
  58. end if
  59. if smallprice<>"" then 
  60. smallprice=CDbl(smallprice)
  61. sql=sql&"and price2 >= "&smallprice
  62. end if
  63. if largeprice<>"" then
  64. largeprice=CDbl(largeprice)
  65. sql=sql&"and price2 <= "&largeprice
  66. end if
  67. if expiredate<>"" then
  68. expiredate=CDate(expiredate)
  69. sql=sql&"and productdate <= #"&expiredate&"#"
  70. end if
  71. if enabledate<>"" then
  72. enabledate=CDate(enabledate)
  73. sql=sql&"and productdate >= #"&enabledate&"#"
  74. end if
  75. sql=sql&" order by "&OrderField&" "&Order
  76. rs.open sql,conn,1,1
  77. if err.number<>0 then
  78. call MsgBox("数据库中无数据","Back","None")
  79. response.End
  80. end if
  81. if rs.eof And rs.bof then
  82. call MsgBox("对不起,找不到你所需的书籍!","Back","None")
  83. response.End
  84. else
  85. totalPut=rs.recordcount
  86. if currentpage<1 then
  87. urrentpage=1
  88. end if
  89. if (currentpage-1)*MaxPerPage>totalput then
  90. if (totalPut mod MaxPerPage)=0 then
  91. currentpage= totalPut  MaxPerPage
  92. else
  93. currentpage= totalPut  MaxPerPage + 1
  94. end if
  95. end if
  96. if currentPage=1 then
  97. else
  98. if (currentPage-1)*MaxPerPage<totalPut then
  99. rs.move  (currentPage-1)*MaxPerPage
  100. dim bookmark
  101.         bookmark=rs.bookmark
  102.         
  103. else
  104. currentPage=1
  105. end if
  106. end if
  107. end if
  108. dim i
  109. i=0
  110. %>
  111. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  112. <html>
  113. <head>
  114. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  115. <title>406网络书店</title>
  116. <link href="style.css" rel="stylesheet" type="text/css">
  117. </head>
  118. <body>
  119. <!--#include file="head.htm"-->
  120. <table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  121.   <tr>
  122.     <td width="219" align="left" valign="top"><!--#include file="left.asp"--></td>
  123.     <td width="561" align="left" valign="top">      <table width="100%" border="0" cellspacing="0" cellpadding="0">
  124.         <tr>
  125.           <td align="left" valign="top"><br>
  126.           <br></td>
  127.         </tr>
  128.         <tr>
  129.           <td align="center" valign="top"><table width="568"  border="0" cellpadding="0" cellspacing="0">
  130. <%
  131. do while not rs.eof
  132. %>
  133.   <tr>
  134.                 <td width="17%" height="130" align="center" valign="middle" class="shadow"><a href="vpro.asp?id=<%=trim(rs("id"))%>" target="_blank"><img src="<%=trim(rs("pic"))%>" width="85" height="125" border="0"></a></td>
  135.                 <td height="130" align="left" valign="top"><table width="100%"  border="0" cellspacing="2" cellpadding="0">
  136.                   <tr>
  137.                     <td colspan="2"><img src="images/w.gif" width="18" height="18"><span class="booktitle"><%=trim(rs("name"))%></span></td>
  138.                   </tr>
  139.                   <tr class="bookinfo">
  140.                     <td width="50%" height="12" class="bookinfo">作 者:<%=trim(rs("author"))%></td>
  141.                     <td width="50%" class="bookinfo"> 出版社:<%=trim(rs("mark"))%></td>
  142.                   </tr>
  143.                   <tr class="bookinfo">
  144.                     <td width="50%">日 期:<%=trim(rs("productdate"))%></td>
  145.                     <td width="50%">VIP价格:<%=rs("vipprice")%></td>
  146.                   </tr>
  147.                   <tr class="bookinfo">
  148.                     <td width="50%"> 定 价:<%=trim(rs("price1"))%></td>
  149.                     <td width="50%"> 优惠价: <%=trim(rs("price2"))%></td>
  150.                   </tr>
  151.                   <tr>
  152.                     <td colspan="2" align="center"><a href="icar.asp?id=<%=rs("id")%>&action=add" target="pcart"><img src="images/car.gif" width="23" height="20" border="0">购物车</a></td>
  153.                   </tr>
  154.                 </table></td>
  155.               </tr>
  156.               <tr>
  157.                 <td colspan="2" align="center"><img src="images/line.gif" width="568" height="9"></td>
  158.               </tr>
  159. <%i=i+1
  160. if i>=MaxPerPage then Exit Do
  161. rs.movenext
  162. loop
  163. rs.close
  164. set rs=nothing%>
  165.                                                       <%  
  166.   
  167. Function showpage(totalnumber,maxperpage,filename)  
  168.    Dim n
  169.   
  170. If totalnumber Mod maxperpage=0 Then  
  171. n= totalnumber  maxperpage  
  172. Else
  173. n= totalnumber  maxperpage+1  
  174. End If
  175. Response.Write "<form method=Post action="&filename&">"  
  176. Response.Write "<p align='center' > "  
  177. If CurrentPage<2 Then  
  178. Response.Write "首页 上一页 "  
  179. Else  
  180. Response.Write "<a href="&filename&"page=1>首页</a> "  
  181. Response.Write "<a href="&filename&"page="&CurrentPage-1&" >上一页</a> "  
  182. End If
  183. If n-currentpage<1 Then  
  184. Response.Write "下一页 尾页"  
  185. Else  
  186. Response.Write "<a href="&filename&"page="&(CurrentPage+1)&" >"  
  187. Response.Write "下一页</a> <a href="&filename&"page="&n&">尾页</a>"  
  188. End If  
  189. Response.Write " 页次:"&CurrentPage&"/"&n&"页 "  
  190. Response.Write " 共有<b>&nbsp;"&totalnumber&"&nbsp;</b>种商品 "&maxperpage&"种商品/页 " 
  191. Response.Write "转到:<input type='text' name='page' size=2 maxlength=10 class=smallInput value="&currentpage&">"  
  192. Response.Write "&nbsp;<input type='submit'   value='GO' name='cndok'></form>"  
  193. End Function  
  194. %>
  195.   
  196.               <tr align="center">
  197.                 <td colspan="2"><br>
  198.                   <form name="form1" method=get action="">
  199.    <INPUT TYPE="hidden" name="name" value="<%=name%>">
  200. <INPUT TYPE="hidden" name="author" value="<%=author%>">
  201. <INPUT TYPE="hidden" name="manufacturer" value="<%=manufacturer%>">
  202. <INPUT TYPE="hidden" name="enabledate" value="<%=enabledate%>">
  203. <INPUT TYPE="hidden" name="expiredate" value="<%=expiredate%>">
  204. <INPUT TYPE="hidden" name="smallprice" value="<%=smallprice%>">
  205. <INPUT TYPE="hidden" name="largeprice" value="<%=largeprice%>">
  206. <INPUT TYPE="hidden" name="code" value="<%=code%>">
  207. <INPUT TYPE="hidden" name="Order" value="<%=Order%>">
  208. <INPUT TYPE="hidden" name="OrderField" value="<%=OrderField%>">
  209.                     <%
  210. showpage totalput,MaxPerPage,"rsearch.asp?name="&name&"&author="&author&"&manufacturer="&manufacturer&"&enabledate="&enabledate&"&expiredate="&expiredate&"&smallprice="&smallprice&"&largeprice="&largeprice&"&code="&code&"&Order="&Order&"&OrderField="&OrderField&"&"
  211. %>
  212.                   </form> </td>
  213.               </tr>
  214.           </table></td>
  215.         </tr>
  216.         <tr>
  217.           <td>&nbsp;</td>
  218.         </tr>
  219.     </table></td>
  220.   </tr>
  221. </table>
  222. <!--#include file="foot.htm"-->
  223. </body>
  224. </html>