info_search.asp

来自「ASP+SQL Server的图书馆管理系统」· ASP 代码 · 共 138 行

ASP
138
字号
<!--#include file="conndb.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>借阅图书信息管理</title>
<link href="style.css" rel="stylesheet">
</head>
<!--#include file="head.asp"-->
<body  >
<br><p align="center">
<form method='POST' action='info_Search.asp'>
            <TABLE cellSpacing=1 cellPadding=4 width=73%  height="136">
              <TBODY>
          <TR>
                <TD >
                  借阅图书信息检索: <select name='Class' size='1' tabindex='0' style="font-size: 9pt">         
<option value='按图书名称'>按图书名称</option>
<option value='按读者姓名'>按读者姓名</option>
<option value='按借阅种类'>按借阅种类</option>
<option value='按借阅数量'>按借阅数量</option>
</select>  
<input type='text' name='Name' size='11' >       
<input type='submit' value='查询' name='Submit'> 
  <% 
 bo_Class=request("Class")
 set rs=server.createobject("adodb.recordset")

 sqltext="select * from book_record where rec_flag=0" 

    if bo_class="按图书名称" then
       sqltext=sqltext &" and rec_bkname like '%"& request("name") &"%' order by rec_lendlimit asc"
    elseif bo_class="按读者姓名" then
       sqltext=sqltext &" and rec_rdrname like '%"& request("name") &"%'  order by rec_lendlimit asc"
    elseif bo_class="按借阅种类" then
       sqltext=sqltext &" and rec_bktype like '%"& request("name") &"%'  order by rec_lendlimit asc"   
    elseif bo_class="按借阅数量" then
       sqltext=sqltext &" and rec_bktotal ="& request("name") &"  order by rec_lendlimit asc"     
    end if
    
   rs.open sqltext,conn,1,1
%>   
	 
    </TD></TR>   
              <TR >
                <TD  height="15">
                  <table border="1" cellpadding="0" cellspacing="0" width="99%" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF" height="74">
                    <tr >
                      <td width="5%" bgcolor="#FEEC85" align="center" height="30"><strong>编号</strong></td>
                      <td width="18%" bgcolor="#FEEC85" align="center" height="30"><strong>借阅图书名称</strong></td>
                      <td width="5%" bgcolor="#FEEC85" align="center" height="30"><strong>数量</strong></td>
                      <td width="9%" bgcolor="#FEEC85" align="center" height="30"><strong>种类</strong></td>
                      <td width="9%" bgcolor="#FEEC85" align="center" height="30"><strong>借阅人</strong></td>
                      <td width="11%" bgcolor="#FEEC85" align="center" height="30"><strong>借阅时间</strong></td>
                      <td width="11%" bgcolor="#FEEC85" align="center" height="30"><strong>应还时间</strong></td>
                      <td width="7%" bgcolor="#FEEC85" align="center" height="30"><strong>备注</strong></td>
                      <td width="11%" bgcolor="#FEEC85" align="center" height="30"><strong>过期(天)</strong></td>
                      <td width="14%" bgcolor="#FEEC85" align="center" height="30"><strong>操作</strong></td>
                    </tr>
 
<%
If rs.EOF Then
    Response.Write "<tr><td colspan=11 align=center>目前还没有借阅信息。</td></tr></table>"
  Else
    '设置每页显示记录的数量
	rs.PageSize = 8
	'读取参数page,表示当前页码
	iPage = CLng(Request("page"))
	If iPage > rs.PageCount Then
	  iPage = rs.PageCount
	End If
	If iPage <= 0 Then
	  iPage = 1
	End If
    rs.AbsolutePage = iPage
    
    For i=1 To rs.PageSize
      n = n + 1
%>                   <tr >
                     <td width="5%" align="center" height="30"><%=n%></td>
                      <td width="18%" align="center" height="30"><%=rs("rec_bkname")%></td>
                      <td width="5%" align="center" height="30"><%=rs("rec_bktotal")%></td>
                      <td width="9%" align="center" height="30"><%=rs("rec_bktype")%></td>
                      <td width="9%" align="center" height="30"><%=rs("rec_rdrname")%></td>
                      <td width="11%" align="center" height="30"><%=rs("rec_lendtime")%></td>
                      <td width="11%" align="center" height="30"><%=rs("rec_lendlimit")%></td>
                      <td width="7%" align="center" height="30"><a href="#" title=<%=rs("rec_remark")%>><font color="#000000"><u>备注</u></font></a></td>
                     <td width="11%" align="center" height="30"><%if DateDiff("d", rs("rec_lendlimit"), date())<0 then %>0<%else%><font color=red><%=DateDiff("d", rs("rec_lendlimit"), date())%></font><%end if%></td>
                      <td width="14%" align="center" height="30">
                      <input type="button" value="归还" onclick="if (confirm('<%=rs("rec_rdrname")%> 借的 <%=rs("rec_bktotal")%>件 <%=rs("rec_bkname")%> 确实要归还吗?')) window.location='return.asp?id=<%=rs("rec_id")%>'" >
                     <input type="button" value="续借" onclick=" window.location='renew_info.asp?id=<%=rs("rec_id")%>'" ></td>
                    </tr>
<%
      rs.MoveNext()
      If rs.EOF Then
        Exit For
      End If
    Next
%>
</table>
<p align="center">
<%   
    '显示页码
	
    If rs.PageCount>1 Then
      Response.Write "<table border='0'>"
      Response.Write "<tr><p align=center>"
      Response.Write "<td><b>分页:</b></td>"
      For i=1 To rs.PageCount
        Response.Write "<td><a href='Info_Search.asp?page=" & i & "'>"
        Response.Write "[<b>" & i & "</b>]</a></td>"
      Next
      Response.Write "</tr></table>"
    End If
  End If
%>
                   
        
  </TBODY>

</td></tr>

</form>
<tr>
      <td><div align="center">Copyright 2007 </div></td>
    </tr>

</body>
</html>









⌨️ 快捷键说明

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