⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rsearch.asp

📁 图书馆模拟管理系统,对里面的功能简单容易懂,一看就会,是学习asp的好东西!
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/config.asp"-->
<%
if request.QueryString="" then 
	call MsgBox("错误:没有搜索条件!","GoUrl","search.asp")
	response.end
end if

'开始分页
Const MaxPerPage=5
dim totalPut   
dim CurrentPage
dim TotalPages
dim j
dim sql
dim nid,sortsid


if Not isempty(request.QueryString("page")) then
	currentPage=Cint(request.QueryString("page"))
else
	currentPage=1
end if 
set rs=server.CreateObject("adodb.recordset")

dim name

name=trim(request.QueryString("name"))
sql="select * from book where 1=1"
if name<>"" then
	sql=sql&" and name like '%"&name&"%' order by pdate desc"
end if
rs.open sql,conn,1,1

if err.number<>0 then
	call MsgBox("数据库中无数据","Back","None")
	response.End
end if
if rs.eof And rs.bof then
	call MsgBox("对不起,找不到你所需的书籍!","Back","None")
	response.End
else
	totalPut=rs.recordcount

if currentpage<1 then
	urrentpage=1
end if

if (currentpage-1)*MaxPerPage>totalput then
	if (totalPut mod MaxPerPage)=0 then
		currentpage= totalPut \ MaxPerPage
	else
		currentpage= totalPut \ MaxPerPage + 1
	end if
end if

if currentPage=1 then
else
	if (currentPage-1)*MaxPerPage<totalPut then
		rs.move  (currentPage-1)*MaxPerPage
		dim bookmark
        bookmark=rs.bookmark
        
	else
		currentPage=1
	end if
	end if

end if

dim i
i=0

%>
<html>
<head>
<style type="text/css">
<!--
body {
	font-size:10pt;
	
}
td {font-size:9pt}
table{font-size:9pt}
.style5 {
	font-family: "隶书";
	font-weight: bold;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<!--#include file="head.asp"-->

<table width="980" border="0" cellpadding="0" cellspacing="0" align="center">
  <!--DWLayoutTable-->
  <tr>
    <td height="14" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <tr>
          <td width="980" height="14">&nbsp;</td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td width="220" rowspan="3" valign="top">
	  <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <tr>
          <td width="136" height="270"><!--#include file="left.htm"--></td>
        </tr>
    </table></td>
    <td width="760" height="36" valign="top">
	  <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <tr>
          <td width="760" height="21" align="center" valign="top"><span class="style5"><font color="#E8A477" size="+2">图书搜索结果</font></span></td>
        </tr>
		<tr><td width="100%"><hr></td></tr>
      </table></td>
  </tr>
  <tr>
    <td height="65" valign="top">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="760" height="44">
		   <form>
		     <table width="100%">
			    <Tr>
				   <td bgcolor="#E8A477">图书名称</td>
				   <td bgcolor="#E8A477">图书编号</td>
				   <td bgcolor="#E8A477">作者</td>
				   <td bgcolor="#E8A477">出版社</td>
				   <td bgcolor="#E8A477">图书类别</td>
				   <td bgcolor="#E8A477">添加日期</td>
				   <td bgcolor="#E8A477">是否借出</td>
				   <td bgcolor="#E8A477">借阅</td>
				</Tr>
				<%
				i=0 
				do while not rs.eof
              
				 %>
				<tr>
				   <td bgcolor="#E8E8E8"><%=trim(rs("name"))%></td>
				   <td bgcolor="#E8E8E8"><%=trim(rs("id"))%></td>
				   <td bgcolor="#E8E8E8"><%=trim(rs("author"))%></td>
				   <td bgcolor="#E8E8E8"><%=trim(rs("press"))%></td>
				   <td bgcolor="#E8E8E8"><%=trim(rs("class"))%></td>
				   <td bgcolor="#E8E8E8"><%=trim(rs("pdate"))%></td>
				   <td bgcolor="#E8E8E8">
				   <% 
				      if rs("iflend")=0 then
				    %>
				   <font color="red">未借</font>
				   <% 
				      else
				    %>
					已借
					<% 
					  end if
					 %>
				   </td>
				   <td bgcolor="#E8E8E8">
				   <% 
				      if rs("iflend")=0 then
				    %>
				    <a href="wantbo.asp?bookid=<%=rs("bookid")%>"><font color="#990033">我要借</font></a>
					<% 
					  end if
					 %>
				   </td>
				</tr>
				<%
                       i=i+1
			           if i>=12 then exit do
			           if not rs.eof then  rs.movenext
			           loop
			           rs.close
                    %>		
			   
			 </table>
		      <table width="100%">
			  <tr><td width="100%"><hr></td></tr>
			  </table>
		   
		   </form>
		
		
		</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="177">&nbsp;</td>
  </tr>
</table>
<!--#include file="foot.htm"-->
</body>
</html>

⌨️ 快捷键说明

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