<form method="post" action="text_search.asp" onsubmit="javascript:return check_Null()" name="form1">
<table border="0" width="603" cellspacing="0" bordercolorlight="#000000" bordercolordark="#000000">
<tr>
<td width="164">
<font size="2">库存搜索</font>
<select name="sousuo" >
<option value="pbh" >编号</option>
<option value="pmc" >名称</option>
<option value="pxh" >型号</option>
<option value="ppp" >品牌</option>
<option value="pcd" >产地</option>
<option value="plb" >类别</option>
<option value="psl" >库存数量</option>
<option value="pdw" >单位</option>
<option value="prq" >更新日期</option>
<option value="pbz" >备注</option>
</select>
</td>
<td width="352"><div align="center">
<input type="text" name="search" size="46"><font size="2"></font>
</div></td><td width="81"><div align="center">
<input type="submit" value="搜索"><font size="2"></font>
</div></td>
<center>
</center>
</table>
</form>
<table style="word-break:break-all"
border="1" width="751" cellspacing="0" bordercolorlight="#000000" bordercolordark="#000000" >
<font size="2"></font>
<tr bordercolor="#CCCCCC">
<td style="word-break:break-all"
width=58 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">序号</font></td>
<td style="word-break:break-all"
width=145 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">编号</font></td>
<td style="word-break:break-all"
width=149 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">名称</font></td>
<td style="word-break:break-all"
width=131 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">型号</font></td>
<td style="word-break:break-all"
width=78 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">品牌</font></td>
<td style="word-break:break-all"
width=76 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">库存数量</font></td>
<td style="word-break:break-all"
width=84 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">类别</font></td>
</tr>
<font size="2">
<%
session("search")=request.form("search")
Dim sql,rs
sql="Select * From ctian1 order by id desc"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql,db,1
If Not rs.Bof And Not rs.Eof Then
Dim page_size
Dim page_no
Dim page_total
page_size=40
If Request("page_no")="" Then
page_no=1
Else
page_no=cint(Request("page_no"))
End If
Session("page_no")=page_no
rs.PageSize=page_size
page_total=rs.PageCount
rs.AbsolutePage=page_no
Dim I,J
I=0
J=page_size
Do While Not rs.Eof And J>0
I=I+1
J=J-1
dim ss
%>
</font>
<tr>
<td><font size="2">
<div align="center">
<% =(page_no-1)*page_size+I %>
</div>
</font></td>
<td style="TABLE-LAYOUT:fixedword-break:break-all"><font size="2"><%=rs("pbh")%></font></td>
<td style="TABLE-LAYOUT:fixedword-break:break-all"><font size="2"><%=rs("pmc")%></font></td>
<td style="TABLE-LAYOUT:fixedword-break:break-all"><font size="2"><%=rs("pxh")%></font></td>
<td style="TABLE-LAYOUT:fixedword-break:break-all"><font size="2"><%=rs("ppp")%></font></td>
<td style="word-break:break-all"><font size="2"><%=rs("psl")%></font></td>
<td style="TABLE-LAYOUT:fixedword-break:break-all"><div align="center"><font size="2"><a href="details.asp?id=<%=rs("id")%>" target="_blank">详细信息</a></font></div></td>
</tr>
<font size="2"></font>
<%
rs.MoveNext
Loop
End If
rs.close()
%>
</table>
<font size="2">
<%
' response.Write"共有"&rs.recordcount&"条记录 "
Call select_page(page_no,page_total)
dim s,t
s=page_no-1
t=page_no+1
%>
<%
if page_no>1 then
%>
<a href="kucun.asp?page_no=<%=s%>">上一页</a>
<%
end if
if page_no<page_total then
%>
<a href="kucun.asp?page_no=<%=t%>">下一页</a>
<%
end if
%>
</font>
下边是搜索结果显示页面代码:
<%
session("search")=request.form("search")
if trim(session("search"))="" then
%>
<script language="javascript">
alert("不允许搜索空格,请正确填写搜索关键词!")
top.location.href="kucun.asp"
</script>
<%
end if
dim rs,strsql
set rs=server.CreateObject("adodb.recordset")
if request("sousuo")="pbh" then
strsql="select * from ctian1 where pbh like '%"&trim(session("search"))&"%'"
else if request("sousuo")="pmc" then
strsql="select * from ctian1 where pmc like '%"&trim(request("search"))&"%'"
else if request("sousuo")="pxh" then
strsql="select * from ctian1 where pxh like '%"&trim(request("search"))&"%'"
else if request("sousuo")="ppp" then
strsql="select * from ctian1 where ppp like '%"&trim(request("search"))&"%'"
else if request("sousuo")="pcd" then
strsql="select * from ctian1 where pcd like '%"&trim(request("search"))&"%'"
else if request("sousuo")="plb" then
strsql="select * from ctian1 where plb like '%"&trim(request("search"))&"%'"
else if request("sousuo")="psl" then
strsql="select * from ctian1 where psl = '"&trim(request("search"))&"'"
else if request("sousuo")="pdw" then
strsql="select * from ctian1 where pdw like '%"&trim(request("search"))&"%'"
else if request("sousuo")="prq" then
strsql="select * from ctian1 where prq like '%"&trim(request("search"))&"%'"
else if request("sousuo")="pbz" then
strsql="select * from ctian1 where pbz like '%"&trim(request("search"))&"%'"
Else If request("sousuo")="" Then
end if
end if
end if
end if
end if
end if
End if
end if
end if
end if
end if
rs.open strsql,db,1
if rs.recordcount<=0 then
%>
<script language="javascript">
alert("没有搜索到符合您要求的库存纪录!")
history.back()
</script>
<%
else
response.write"查询结果: 共找到"&rs.recordcount &"个结果"
end if
%>
<table border="1" width="750" bordercolor="#C0C0C0" cellspacing="0" height="50">
<table style="word-break:break-all"
border="1" width="751" cellspacing="0" bordercolorlight="#000000" bordercolordark="#000000" >
<font size="2"></font>
<tr bordercolor="#CCCCCC">
<td style="word-break:break-all"
width=145 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">编号</font></td>
<td style="word-break:break-all"
width=149 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">名称</font></td>
<td style="word-break:break-all"
width=131 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">型号</font></td>
<td style="word-break:break-all"
width=78 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">品牌</font></td>
<td style="word-break:break-all"
width=76 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">库存数量</font></td>
<td style="word-break:break-all"
width=84 height="20"align="center" bordercolor="#808080" bgcolor="#C0C0C0" ><font size="2">类别</font></td>
</tr>
<%
If Not rs.Bof And Not rs.Eof Then
Do While Not rs.Eof And not rs.bof
%>
<tr>
<td style="TABLE-LAYOUT:fixedword-break:break-all"><font size="2"><%=rs("pbh")%></font></td>
<td style="TABLE-LAYOUT:fixedword-break:break-all"><font size="2"><%=rs("pmc")%></font></td>
<td style="TABLE-LAYOUT:fixedword-break:break-all"><font size="2"><%=rs("pxh")%></font></td>
<td style="TABLE-LAYOUT:fixedword-break:break-all"><font size="2"><%=rs("ppp")%></font></td>
<td style="word-break:break-all"><font size="2"><%=rs("psl")%></font></td>
<td style="TABLE-LAYOUT:fixedword-break:break-all"><div align="center"><font size="2"><a href="details.asp?id=<%=rs("id")%>" target="_blank">详细信息</a></font></div></td>
</tr>
<%
rs.movenext
loop
end if
'end if
'rs.close()
%>
</table>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)