search_keys.asp

来自「大家好」· ASP 代码 · 共 146 行

ASP
146
字号
<%@ Language=VBScript %>
<!--#INCLUDE FILE="adovbs.inc"-->
<%
	PageNum=Cint(Request("pagenum"))
	fenlei1=Request("fenlei1")
	keyword=Request("keyword")
	PageSize=10
	base=(PageNum-1)*PageSize
	Set con=Server.CreateObject("ADODB.Connection")
	con.Open Application("DBCon_ConnectionString")
	'查找DB
	'采用RecordSet的分页
	Set rs=Server.CreateObject("ADODB.RecordSet")
	rs.CursorType=adOpenStatic
	rs.PageSize=5
	strSql="SELECT * FROM guanggao WHERE "
	if session("city")="all" then
		strSql=strSql+"fenlei1='"
	else
		strSql=strSql+"chengshi='"+session("city")+"' AND fenlei1='"
	end if
	strSql=strSql+fenlei1+"' AND neirong LIKE '%"
	strSql=strSql+keyword+"%'"
	
	updateSql="update guanggao set liulancishu=liulancishu +1 WHERE "
	if session("city")="all" then
		updateSql=updateSql+"fenlei1='"
	else
		updateSql=updateSql+"chengshi='"+session("city")+"' AND fenlei1='"
	end if
	updateSql=updateSql+fenlei1+"'"
	if fenlei2<>"" then 
		updateSql=updateSql+" AND fenlei2='"+fenlei2+"'"
	end if
	rs.Open strSql,con
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<link rel="stylesheet" href="../html/3508.css">
<style type="text/css">
<!--
.red {  color: #FF0000}
.green {  color: #006600}
.botton {  color: #000000; background-color: #FFFFF8; font-size: 12px}
-->
</style>
</HEAD>
<BODY background="../images/bg1.gif">
<table width="740" border="0" cellspacing="0" cellpadding="0" align="center" height="40">
  <tr class="botton"> 
    <td width="217" height="39" align="center" valign="bottom"><img src="../images/smallmark.gif" width="120" height="25"></td>
    <td width="523" valign="bottom" height="39"><a href="../default.asp">本站首页</a> 
      &gt;&gt; 商品信息</td>
  </tr>
  <tr> 
    <td colspan="2" height="1" bgcolor="006600"></td>
  </tr>
</table>
<table width="740" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>  <span class="green">你要查找的是:</span><span class="red">【<%=fenlei1%>--&gt;<%=keyword%>】</span>    
      <%if not rs.EOF then	
	rs.AbsolutePage=PageNum
	RowCount=0%><span class="red">共找到 <%=rs.RecordCount%> 条相关信息!</span></td>
  </tr>
  <tr align="center"> 
    <td> <%for i = 1 to RS.PageCount%> <a href="search_keys.asp?pagenum=<%=i%>&keyword=<%=keyword%>&fenlei1=<%=fenlei1%>"><%=i%></a>  <%next%> 
    </td>
</tr>
</table>
<table width="620" border="0" cellspacing="0" cellpadding="0" align="center">
  <%
	While not rs.EOF and RowCount< rs.PageSize
	RowCount=RowCount+1
%> 
  <tr>
    <td colspan="4" height="1" bgcolor="006600"></td>
  </tr>
  <tr> 
    <td colspan="4">   <span class="red">№<%=RowCount+base%></span></td>
  </tr>
  <tr> 
    <td width="76" class="green">【单位名称】</td>
    <td width="273"><%=rs("danwei")%></td>
    <td width="75" class="green">【联系人】</td>
    <td width="196"><% =rs("lianxiren")%></td>
  </tr>
  <tr> 
    <td width="76" class="green">【联系地址】</td>
    <td width="273"><%=rs("dizhi")%></td>
    <td width="75" class="green">【邮政编码】</td>
    <td width="196"><%=rs("youbian")%></td>
  </tr>
  <tr> 
    <td width="76" class="green">【联系电话】</td>
    <td width="273"><%=rs("dianhua")%></td>
    <td width="75">&nbsp;</td>
    <td width="196">&nbsp;</td>
  </tr>
  <tr> 
    <td width="76" class="green" valign="top">【发布内容】</td>
    <td colspan="3" bgcolor="#F4F4FF"><span class="red"><% =rs("neirong")%></span></td>
  </tr>
  <tr> 
    <td colspan="4"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td><span class="green">【代理商】</span><% =rs("dailishang")%></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td colspan="4" height="1" bgcolor="006600"></td>
  </tr>
<%
	if RowCount=1 then 
		temp="yonghu='" & rs("yonghu") & "'"
	else
	   	temp= temp & " OR yonghu='" & rs("yonghu") & "'"
	end if
	rs.MoveNext
	Wend
updateSql = updateSql & "AND (" & temp & ")"
'response.write updatesql
con.execute updateSql
%>
  <tr align="center"> 
    <td colspan="4"> <%if PageNum>1 then %> <a href="search_keys.asp?pagenum=<%=(PageNum-1)%>&keyword=<%=keyword%>&fenlei1=<%=fenlei1%>">上一页</a> 
      <%end if %> <%if PageNum<rs.PageCount then%> <a href="search_keys.asp?pagenum=<%=(PageNum+1)%>&keyword=<%=keyword%>&fenlei1=<%=fenlei1%>">下一页</a> 
      <%end if %> </td>
</tr>
  <tr align="right"> 
    <td colspan="4">
      <input type="submit" name="Submit" value="返回主页" onclick="location.href='../default.asp'" class="botton">
    </td>
  </tr>
</table>
<!-- #include file="../include/end.htm" -->
<%else
'没有查找到纪录
%><p align="center"> 太奇怪了!居然没有找到!     <A href="..\.\default.asp">返回主页</A><%  end if%> 
</BODY>
</HTML>

⌨️ 快捷键说明

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