⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search_result.asp

📁 oracle9i程序事例集
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" %>
<%
  dim conn
  dim connstr
  Set conn=Server.CreateObject("ADODB.Recordset")
  connstr="Driver={Microsoft ODBC for Oracle};server=mylink;uid=system;pwd=system;"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>搜寻商品信息结果</title>
<style type="text/css">
<!--
.style2 {font-size: x-small}
-->
</style>
<style>
td {
	font-size: 13px;
}
</style>
</head>

<body>
<div align="left"><!-- #include file="pagetop.asp" --></div>
<div align="center"><center>
<table width="95%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="30" colspan="2">&nbsp;</td>
    </tr>
  <tr>
    <td width="180" valign="top">
	  <table width="180" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><!-- #include file="userinfo.asp" --></td>
        </tr>
        <tr>
          <td><!-- #include file="companyinfo.asp" --></td>
        </tr>
        <tr>
          <td><!-- #include file="search_easy.asp" --></td>
        </tr>
      </table>  
	</td>
    <td valign="top">
	<%
  Const MaxPerPage=10
  dim totalPut   
  dim CurrentPage
  dim TotalPages
  dim j
  stype=request("type")
  set rs=server.CreateObject("adodb.recordset")
  if stype<>"" then
  SELECT CASE stype
  CASE "pinpai"
  sstype=request.Form("pinpai")
  sql="select product_id, product_kindnum, product_burn_ability, product_media_inuse, product_temp_inuse, product_price from GSCOTT.product_info_table where product_isdel='n' and product_burn_ability='"&sstype&"'"&" order by product_id" 
  CASE "xinghao"
  sstype=request.Form("xinghao")
  sql="select product_id, product_kindnum, product_burn_ability, product_media_inuse, product_temp_inuse, product_price from GSCOTT.product_info_table where product_isdel='n' and product_kindnum like '%"&ucase(sstype)&"%'"&" order by product_id" 
  CASE "jiage"
  sstype=request.Form("jiage")
  SELECT CASE sstype
  CASE "0"
  sql="select product_id, product_kindnum, product_burn_ability, product_media_inuse, product_temp_inuse, product_price from GSCOTT.PRODUCT_INFO_TABLE where product_isdel='n' and product_price<=100"
  CASE "1"
  sql="select product_id, product_kindnum, product_burn_ability, product_media_inuse, product_temp_inuse, product_price from GSCOTT.PRODUCT_INFO_TABLE where product_isdel='n' and product_price between 100 and 150"
  CASE "2"
  sql="select product_id, product_kindnum, product_burn_ability, product_media_inuse, product_temp_inuse, product_price from GSCOTT.PRODUCT_INFO_TABLE where product_isdel='n' and product_price between 150 and 200"
  CASE "3"
  sql="select product_id, product_kindnum, product_burn_ability, product_media_inuse, product_temp_inuse, product_price from GSCOTT.PRODUCT_INFO_TABLE where product_isdel='n' and product_price between 200 and 300"
  CASE "4"
  sql="select product_id, product_kindnum, product_burn_ability, product_media_inuse, product_temp_inuse, product_price from GSCOTT.product_info_table where product_isdel='n' and product_price>=300" 
  END SELECT
  END SELECT
  else
  sql=replace(request.QueryString("sql"),"-"," ")
  end if
  
  sql1=replace(sql," ","-")
  
  if Not isempty(request("page")) then
     currentPage=Cint(request("page"))
  else
     currentPage=1
  end if

  rs.open sql,connstr,1,1
		  
  if err.number<>0 then
	 response.write "<p>数据库中暂时无数据</p>"
  end if
				
  if rs.eof And rs.bof then
%>
对不起,您搜索的商品不存在,请缩小查询范围或者输入正确信息。<a href="javascript:history.go(-1)">返回上一页</a>。
<% else %>
<table width="750" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="30" colspan="7" align="center"><font size="2px" color="#0000FF">查询结果</font></td>
    </tr>
  <tr align="center">
    <td width="15%" height="30">产品型号</td>
    <td width="10%">燃烧能力</td>
    <td width="15%">燃烧媒介</td>
    <td width="12%">适用风温</td>
    <td width="13%">产品价格</td>
	</tr>
<%
	 totalPut=rs.recordcount

  if currentpage<1 then
     currentpage=1
  end if

  if (currentpage-1)*MaxPerPage>totalput then
	 if (totalPut mod MaxPerPage)=0 then
	 	currentpage= totalPut \ MaxPerPage
	 else
	 	currentpage= totalPut \ MaxPerPage + 1
	 end if
  end if

  if currentPage=1 then
   	 showContent
     showpage totalput,MaxPerPage,"search_result.asp"
  else
     if (currentPage-1)*MaxPerPage<totalPut then
        rs.move  (currentPage-1)*MaxPerPage
        dim bookmark
        bookmark=rs.bookmark
        showContent
        showpage totalput,MaxPerPage,"search_result.asp"
     else
	    currentPage=1
        showContent
        showpage totalput,MaxPerPage,"search_result.asp"
	 end if
  end if
  end if

  sub showContent
      dim i
	  i=0

  do while not rs.eof
%>
  <tr align="center">
    <td height="30"><a href="shp_detail.asp?id=<%=rs("product_id")%>" target="_blank"><%=rs("product_kindnum") %></a></td>
    <td><%=rs("product_burn_ability") %></td>
    <td><%=rs("product_media_inuse") %></td>
    <td><%=rs("product_temp_inuse") %></td>
    <td><%=rs("product_price") %></td>
  </tr>
<%
  i=i+1
  if i>=MaxPerPage then exit do
  rs.MoveNext
  loop
  rs.Close
  set rs=nothing
%>
</table>
<% 
  end sub
  
  Function showpage(totalnumber,maxperpage,filename)  
  Dim n
  				
  If totalnumber Mod maxperpage=0 Then  
	 n= totalnumber \ maxperpage  
  Else
	 n= totalnumber \ maxperpage+1  
  End If %>
<form method="Post" action="<%=filename%>?sql=<%=sql1%>">
<table width="700" border="0" cellspacing="0" cellpadding="0">
  <tr align="center">
  <% If CurrentPage<2 Then  %>
    <td width="8%" height="25"><span class="style2">首页</span></td>
    <td width="8%"><span class="style2">上一页</span></td>
  <% Else %>
    <td width="8%"><a href=<%=filename%>?page=1&sql=<%=sql1%> class="style2">首页</a></td>
    <td width="8%"><a href=<%=filename%>?page=<%=CurrentPage-1%>&sql=<%=sql1%> class="style2">上一页</a></td>
  <% end if %>
  <% If n-currentpage<1 Then %>
    <td width="8%"><span class="style2">下一页</span></td>
    <td width="8%"><span class="style2">末页</span></td>
  <% Else %>
    <td width="8%"><a href=<%=filename%>?page=<%=(CurrentPage+1)%>&sql=<%=sql1%>><span class="style2">下一页</span></a></td>
    <td width="8%"><a href=<%=filename%>?page=<%=n%>&sql=<%=sql1%> class="style2">末页</a></td>
  <% end if %>
    <td width="8%"><span class="style2">第<%=CurrentPage%>页</span></td>
    <td width="8%" class="style2">共<%=n%>页</td>
    <td width="16%" height="25" colspan="2" align="center" class="style2">共<%=totalnumber%>条记录</td>
    <td width="16%" colspan="2" align="center" class="style2">每页<%=maxperpage%>条记录</td>
    <td colspan="2" align="center" width="20%"><span class="style2">转到第
        <input type="text" name="page" size="2" maxlength="10" value="<%=currentpage%>">
      页</span>    <input type="submit" value="跳转" name="cndok"></td>
  </tr>
  <tr><td height="20" colspan="13" align="right">&nbsp;&nbsp;</td>
</table>
</form>
<%
  End Function 
%>
</td>
  </tr>
  <tr>
    <td height="30" colspan="2">&nbsp;</td>
    </tr>
</table>
<!-- #include file="pagefooter.html" -->
</center>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -