📄 search_exp.asp
字号:
<!--#include file="../inc/adconn.asp"-->
<!--#include file="../css.asp"-->
<%
if session("admin_name")="" then
response.end
end if%>
<%
dim rs,sql
Select Case Request("Action")
Case "search"
search()
Case else
list()
end Select
%>
<%sub search()%>
<form action="book_search.asp?action=list" method="post" ><TABLE width="80%" border="0" cellspacing="1" bgcolor="#336699" align="center"><TR>
<TD width=403 height=31 background="../images/pics/tile_sub.gif" colspan="2">借阅图书信息检索: <select name='Class' size='1' tabindex='0' style="font-size: 9pt">
<option value='按图书名称'>按图书名称</option>
<option value='按借阅人'>按借阅人</option>
<option value='按借阅种类'>按借阅种类</option>
<option value='按借阅数量'>按借阅数量</option>
<option value='按过期天数'>按过期天数</option>
<option value='按借阅时间前'>按借阅时间前</option>
<option value='按借阅时间后'>按借阅时间后</option>
<option value='按归还时间前'>按归还时间前</option>
<option value='按归还时间后'>按归还时间后</option>
</select><span class="main1">
<input type='text' name='Name' size='11' onMouseOver = "this.style.backgroundColor = '#E5F0FF'" onMouseOut = "this.style.backgroundColor = ''" style="font-family: 新细明体, 宋体, Arial; font-size: 9pt; height:18px;background-color:#f3f3f3;border:1 solid black">
</span> <input type='submit' value='查询' name='Submit' style="font-family: 新细明体, 宋体, Arial; font-size: 9pt; height:20px;background-color:#D4D0C8;" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#D4D0C8'"> </TD>
</TR>
</TABLE></form>
<%end sub%>
<%sub list()%>
<%
'图书类别
bo_Class=request("Class")
'图书名称
bo_name=request("name")
'记录集对象
set rs=server.createobject("adodb.recordset")
'根据用户的选择生成SQL语句
sqltext="select * from [book] "
'排序依据
'如果用户选择按图书名称
if bo_class="按图书名称" then
sqltext=sqltext &" where Title like '%"& request("name") &"%' order by retime asc"
elseif bo_class="按借阅人" Then
'如果用户选择按借阅人
sqltext=sqltext &" where Owner like '%"& request("name") &"%' order by retime asc"
elseif bo_class="按借阅种类" Then
'如果用户选择按借阅种类
sqltext=sqltext &" where Btype like '%"& request("name") &"%' order by retime asc"
elseif bo_class="按借阅数量" Then
'如果用户选择按借阅数量
sqltext=sqltext &" where RentCount ="& request("name") &" order by retime asc"
elseif bo_class="按过期天数" Then
'如果用户选择按过期天数
sqltext=sqltext &" where datediff('d', retime, date()) >= "& request("name") &" order by retime asc"
elseif bo_class="按借阅时间前" Then
'如果用户选择按借阅时间前
sqltext=sqltext &" where datediff('d', letime, # "&request("name")& "#) >0 order by bo_retime asc"
elseif bo_class="按借阅时间后" Then
'如果用户选择按借阅时间后
sqltext=sqltext &" where datediff('d',# "&request("name")& "#, letime ) >0 order by retime asc"
elseif bo_class="按归还时间前" Then
'如果用户选择按归还时间前
sqltext=sqltext &" where datediff('d', retime, # "&request("name")& "#) >0 order by retime asc"
elseif bo_class="按归还时间后" Then
'如果用户选择按归还时间后
sqltext=sqltext &" where datediff('d', retime, # "&request("name")& "#) <0 order by retime asc"
end if
'执行查询,打开记录集
rs.open sqltext,conn,1,1
%>
<%
if rs.eof then
response.write "<font color='red'>"
response.write "暂且没有资料"
response.write "</font>"
response.end
else
rs.PageSize =8 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
i=0
end if
%><%
if rs.eof then
response.write "<font color='red'>"
response.write "暂且没有资料"
response.write "</font>"
response.end
else
rs.PageSize =8 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
i=0
end if
%>
</p>
<TABLE border="0" cellspacing="0" width="80%" cellpadding="0" align="center">
<TR>
<TD height=25 align=center bgcolor="#FFff00">查找图书列表</TD>
</TR>
</TABLE>
<TABLE width="80%" border="0" cellpadding="4" cellspacing="1" bgcolor="#663993" align="center">
<tr height=25 >
<TD width="67" align="center" background="manage/images/pics/tile_sub.gif"><font color="#FFFFFF"><b>图书ID号</b></font></TD>
<TD width="153" align="center" background="manage/images/pics/tile_sub.gif"><font color="#FFFFFF"><b>图书名</b></font></TD>
<TD width="110" align="center" background="manage/images/pics/tile_sub.gif"><font color="#FFFFFF"><b>出版社</b></font></TD>
<TD width="110" align="center" background="manage/images/pics/tile_sub.gif"><font color="#FFFFFF"><b>作者</b></font></TD>
<TD width="110" align="center" background="manage/images/pics/tile_sub.gif"><font color="#FFFFFF"><b>图书类型</b></font></TD>
<TD width="110" align="center" background="manage/images/pics/tile_sub.gif"><b><font color="#FFFFFF">状态</font></b></TD>
<TD width="106" align="center" background="manage/images/pics/tile_sub.gif"><font color="#FFFFFF"><b>操作</b></font></TD>
</TR>
<% do while not rs.eof and i< rs.pagesize
i=i+1
%>
<tr height="15">
<td width="67" height="28" align="center" bgcolor="#ffffff"><font face="Arial"><b><%=rs("ID")%></b></font></td>
<td width="153" bgcolor="#ffffff"><a href="/manage/book/book_view.asp?id=<%=rs("ID")%>" target="_blank"><%=rs("Title")%></a></td>
<td width="110" align="center" bgcolor="#ffffff"><%=rs("Issuer")%></td>
<td width="110" align="center" bgcolor="#ffffff"><% =rs("Author") %></td>
<td width="110" align="center" bgcolor="#ffffff"><% =rs("Btype") %></td>
<td width="110" align="center" bgcolor="#ffffff"><%
if rs("Status")=0 then response.write "在库"
if rs("Status")=1 then response.write "借出"
if rs("Status")=2 then response.write "已预定"
%></td>
<td width="106" align="center" bgcolor="#ffffff"><a href="delbook.asp?id=<%=rs("ID")%>" onClick="return checkIn();">删除</a>||<a href="book_mod.asp?id=<%=rs("ID")%>">修改</a></td>
</tr>
<%
rs.movenext
loop%>
<TR>
<TD height="30"
colSpan=7 bgcolor="#FFFFFF" id=mainfoot> <div align="center">共<font color=red><%=maxpage%></font>页 第<%=page%>页 <font color=666666>
<%if page-1>0 then%>
<a href="book_search.asp?aciton=list&page=<%=page-1%>">上一页</a>
<%else%>
<font color=666666>上一页</font>
<%end if%>
<%if page+1<=maxpage then%>
<a href="book_search.asp?aciton=list&page=<%=page+1%>">下一页</a>
<%else%>
<font color=666666>下一页</font>
<%end if%>
</font>共<% =iCount %>条记录</div></TD>
</TR>
</table>
<%rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<%end sub%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -