📄 spsearch.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Inc/Dataconn.asp" -->
<!--#include file="Inc/Funcs.asp" -->
<%
'生成按类别查询的SQL语句
'Call CheckAdmin
if request.form("Action")="SearchByLB" then
SPLBID=request.form("SPLBID")
SPName=request.form("SPName")
'if SPName="" then
' Call eMessage("请输入查询关键字!")
'end if
SearchType=request.form("SearchType")
if SearchType="MHCX" then
SQLStr="Select SPID,SPName,SPLBID from SP where SPLBID="& SPLBID &" and SPName like '%"&SPName&"%'"
elseif SearchType="JQCX" then
SQLStr="Select SPID,SPName,SPLBID from SP where SPLBID="& SPLBID &" and SPName = '"&SPName&"'"
end if
end if
if request.form("Action")="SearchByGYS" then
SPGYSID=request.form("SPGYSID")
SPName=request.form("SPName")
'if SPName="" then
' Call eMessage("请输入查询关键字!")
'end if
SearchType=request.form("SearchType")
if SearchType="MHCX" then
SQLStr="Select SPID,SPName,SPLBID from SP where SPGYSID="& SPGYSID &" and SPName like '%"&SPName&"%'"
elseif SearchType="JQCX" then
SQLStr="Select SPID,SPName,SPLBID from SP where SPGYSID="& SPGYSID &" and SPName = '"&SPName&"'"
end if
end if
if request.form("Action")="SearchBySPName" then
SPName=request.form("SPName")
'if SPName="" then
' Call eMessage("请输入查询关键字!")
'end if
SearchType=request.form("SearchType")
if SearchType="MHCX" then
SQLStr="Select SPID,SPName,SPLBID from SP where SPName like '%"&SPName&"%'"
elseif SearchType="JQCX" then
SQLStr="Select SPID,SPName,SPLBID from SP where SPName = '"&SPName&"'"
end if
end if
'按商品销售排行搜索
if request.form("Action")="SearchBySellPH" then
SortType=request.form("SortType")
SellLength=request.form("SellLength")
if SellLength="" then
call emessage("请输入长度!")
end if
if IsNumeric(SellLength)=false then
call emessage("请输入数字!")
end if
if Int(SellLength)<=0 then
call emessage("请输入大于0的整数!")
end if
if SortType="SX" then '升序
SQLStr="Select SPID,SPName,SPLBID from SP where SPID In(Select top "& SellLength &" SPID from KC order by OutSL asc)"
elseif SortType="JX" then '降序
SQLStr="Select SPID,SPName,SPLBID from SP where SPID In(Select top "& SellLength &" SPID from KC order by OutSL desc)"
end if
end if
%>
<%'=SQLStr%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>商品查询</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="Inc/css.css" rel="stylesheet" type="text/css" />
<!--#include file="Inc/hlink.asp" -->
<style type="text/css">
<!--
.STYLE2 {
font-size: 14px;
color: #000033;
}
.STYLE3 {color: #000033}
-->
</style>
</head>
<body>
<table width="612" height="450" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="25" align="center" background="Images/tbtitle.jpg"><span class="STYLE2">商品查询</span></td>
</tr>
<%if request.querystring("SearchType")="ByLB" then%>
<form name="Form1" id="from1" method="post" action="SPSearch.asp">
<tr>
<td height="20" bgcolor="#FFFFFF" class="Txt"> 商品类别:
<%
SQLStr="select LBID,LBName from LB"
rS.open SQLStr,conn,1,1
%>
<select name="SPLBID" id="SPLBID">
<%for i=1 to rS.recordcount%>
<option value="<%=rS(0)%>"><%=rS(1)%></option>
<%rS.movenext
next
rS.close %>
</select> 查询关键字:
<input name="SPName" type="text" class="InputStyleShort" id="SPName" />
查询方式:
<select name="SearchType" id="SearchType">
<option value="MHCX">模糊查询</option>
<option value="JQCX">精确查询</option>
</select>
<input name="Action" type="hidden" id="Action" value="SearchByLB" />
<input name="Submit" type="submit" class="Button1" value="查询" /></td>
</tr>
</form>
<%end if%>
<%if request.querystring("SearchType")="ByGYS" then%>
<form name="Form2" id="from2" method="post" action="SPSearch.asp">
<tr>
<td height="20" bgcolor="#FFFFFF" class="Txt"> 商品供应商:
<%
SQLStr="select GYSID,GYSName from GYS"
rS.open SQLStr,conn,1,1
%>
<select name="SPGYSID" id="SPGYSID">
<%for i=1 to rS.recordcount%>
<option value="<%=rS(0)%>"><%=rS(1)%></option>
<%rS.movenext
next
rS.close %>
</select>
查询关键字:
<input name="SPName" type="text" class="InputStyleShort" id="SPName" />
查询方式:
<select name="SearchType" id="SearchType">
<option value="MHCX">模糊查询</option>
<option value="JQCX">精确查询</option>
</select>
<input name="Action" type="hidden" id="Action" value="SearchByGYS" />
<input name="Submit2" type="submit" class="Button1" value="查询" /></td>
</tr>
</form>
<%end if%>
<%if request.querystring("SearchType")="BySPName" then%>
<form name="Form3" id="from3" method="post" action="SPSearch.asp">
<tr>
<td height="20" bgcolor="#FFFFFF" class="Txt"> 商品名称:
<input name="SPName" type="text" class="InputStyleShort" id="SPName" />
查询方式:
<select name="SearchType" id="SearchType">
<option value="MHCX">模糊查询</option>
<option value="JQCX">精确查询</option>
</select>
<input name="Action" type="hidden" id="Action" value="SearchBySPName" />
<input name="Submit22" type="submit" class="Button1" value="查询" /></td>
</tr>
</form>
<%end if%>
<%if request.querystring("SearchType")="BySellPH" then%>
<form name="Form3" id="from3" method="post" action="SPSearch.asp">
<tr>
<td height="20" bgcolor="#FFFFFF" class="Txt"> 按销售排行查询:
<select name="SortType" id="SortType">
<option value="SX">升序</option>
<option value="JX">降序</option>
</select>
查询长度:
<input name="SellLength" type="text" class="InputStyleShort" id="SellLength" />
<input name="Action" type="hidden" id="Action" value="SearchBySellPH" />
<input name="Submit3" type="submit" class="Button1" value="查询" /></td>
</tr>
</form>
<%end if%>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="25" align="center" background="Images/tbtitle.jpg" class="Txt"><span class="STYLE3">商品编号</span></td>
<td align="center" background="Images/tbtitle.jpg" class="Txt"><span class="STYLE3">商品名称</span></td>
<td align="center" background="Images/tbtitle.jpg" class="Txt"><span class="STYLE3">商品类别</span></td>
</tr>
<%
if request.form("Action")<>"" then
rS.open SQLStr,conn,1,1 '执行SQL操作
if rS.recordcount=0 then
call Message("无此商品!")
end if
for i=1 to rS.recordcount
%>
<tr>
<td height="20" align="center" bgcolor="#FFFFFF" class="Txt"><a href="ViewSP.asp?SPID=<%=rS(0)%>"><%=rS(0)%></a></td>
<td align="center" bgcolor="#FFFFFF" class="Txt"><a href="ViewSP.asp?SPID=<%=rS(0)%>"><%=rS(1)%></a></td>
<td align="center" bgcolor="#FFFFFF" class="Txt"><%=GetLBNameByLBID(rS(2))%></td>
</tr>
<%rS.movenext
next
end if
%>
</table>
<br>
<center><a href="<%=request.serverVariables("HTTP_REFERER")%>" class="Txt">返回上一页</a>
</center>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -