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

📄 query.asp

📁 书店的管理系统。不错的一个源程序。提供给大家。
💻 ASP
字号:
<!--#include File="adovbs.inc"-->
<html>

<head>
<title>图书查询</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<style>
A.title2:link {text-decoration:none;color:#ffffff;font-size:13px}
A.title2:visited {text-decoration:none;color:#ffffff;font-size:13px}
A.title2:active {text-decoration:none;color:#ffffff;font-size:13px}
A.title2:hover {text-decoration:none;color:#ff0000;font-size:13px}
</style>


<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function form2_onsubmit(theForm) {
  if (theForm.number.value == "")
  {
    alert("请输入 \"购买册数\" .");
    theForm.number.focus();
    return (false);
  }

  if ( (theForm.number.value > 1000)||(theForm.number.value < 1) )
  {
    alert("请重新输入 \"购买册数\" .");
    theForm.number.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.number.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("请重新输入 \"购买册数\" .");
    theForm.number.focus();
    return (false);
  }
return (true)
}

function b_go_onclick(theForm,maxPage) {
  if (theForm.GotoPageNo.value == "")
  {
    alert("请输入 \"要转到的页数\" .");
    theForm.GotoPageNo.focus();
    return (false);
  }

  if ( (theForm.GotoPageNo.value > maxPage)||(theForm.GotoPageNo.value < 1) )
  {
    alert("请重新输入 \"要转到的页数\" .");
    theForm.GotoPageNo.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.GotoPageNo.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("请重新输入 \"要转到的页数\" .");
    theForm.GotoPageNo.focus();
    return (false);
  }
return (true)
}

//-->
</SCRIPT>
</head>

<%
tet=Request.form("tet")
r1=Request.form("R1")
Mv = Request.form("Mv")
PageNo = Request.form("PageNo")
GotoPageNo = CInt(Request.form("GotoPageNo"))
%>

<body topmargin="5" vlink="#0000FF" alink="#FF0000" link="#0000FF">
<div align="center"><center><p>

<form method="POST" name="form1" action="query.asp">
   <input type="text" name="tet" size="21" value="<%=tet%>">
   
   <input type="submit" value="搜索" name="B1" style="font-size: 9pt">
   <input type="reset" value="重输" name="B2" style="font-size: 9pt"><br>

   <input type="radio" value="1" name="R1" <%if r1=1 then%> checked <%end if%> ><span style="font-size: 9pt">书名 
   <input type="radio" value="2" name="R1" <%if r1=2 then%> checked <%end if%> >作者 
   <input type="radio" value="3" name="R1" <%if r1=3 then%> checked <%end if%> >出版社 
   <input type="radio" value="5" name="R1" <%if r1=5 then%> checked <%end if%> >ISBN 
</form>
      
</p></center></div>

<%
if tet="" or isnull(tet) or isempty(tet) or instr(1,lcase(tet)," or ") then
	Response.End 
end if
%>

<p align="center"><img src="../images/ball.gif" WIDTH="14" HEIGHT="14"> 
<strong><big>图书查询结果</big></strong> 
<img src="../images/ball.gif" WIDTH="14" HEIGHT="14"></p>

<p></p>

<%
set con=server.createobject("ADODB.Connection")
con.open Application("str_con")

set res=server.createobject("ADODB.Recordset")
set res.ActiveConnection = con

select case r1
	case 1
		title_name=Request.form("tet")
		res.source="select XHBID,丛书名,正书名,副书名,责任者,其他责任者,出版日期,出版者,FMZPID,定价,flag_new,flag_pre,hits,折扣,备注 from bookW where (正书名 like '%"&title_name&"%') or (副书名 like '%"&title_name&"%') or (丛书名 like '%"&title_name&"%')"

	case 2
		author=Request.form("tet")
		res.source="select XHBID,丛书名,正书名,副书名,责任者,其他责任者,出版日期,出版者,FMZPID,定价,flag_new,flag_pre,hits,折扣,备注 from bookW where (责任者 like '%"&author&"%') or (其他责任者 like '%"&author&"%')"

	case 3
		pub_name=Request.form("tet")
		res.source="select XHBID,丛书名,正书名,副书名,责任者,其他责任者,出版日期,出版者,FMZPID,定价,flag_new,flag_pre,hits,折扣,备注 from bookW where 出版者 like '%"&pub_name&"%'"

	case 4
		pub_date=Request.form("tet")
		if isnumeric(pub_date)=true then
			res.source="select XHBID,丛书名,正书名,副书名,责任者,其他责任者,出版日期,出版者,FMZPID,定价,flag_new,flag_pre,hits,折扣,备注 from bookW where year(出版日期)='"&pub_date&"'"

		elseif isDate(pub_date)=false then
			response.write "出版日期错,请重填 !"
			response.end
		else
			pub_date=cdate(pub_date)
			year1=year(pub_date)
			month1=month(pub_date)
			res.source="select XHBID,丛书名,正书名,副书名,责任者,其他责任者,出版日期,出版者,FMZPID,定价,flag_new,flag_pre,hits,折扣,备注 from bookW where year(出版日期)='"&year1&"' and month(出版日期)='"&month1&"'"
		end if

	case 5
		isbn=Request.form("tet")
		res.source="select XHBID,丛书名,正书名,副书名,责任者,其他责任者,出版日期,出版者,FMZPID,定价,flag_new,flag_pre,hits,折扣,备注 from bookW where ISBN='"&isbn&"'"

	case else
		res.source="select XHBID,丛书名,正书名,副书名,责任者,其他责任者,出版日期,出版者,FMZPID,定价,flag_new,flag_pre,hits,折扣,备注 from bookW"

end select

res.pagesize=10
res.cursorlocation=3
res.open ,,adOpenStatic

PageCount = res.PageCount

if res.eof=true then
	response.write "没有满足条件的图书 !"
else
	If PageNo = "" Then
		PageNo = 1
	End If

	Select Case Mv
		Case "首页"
			PageNo = 1

		Case "上一页"
			If PageNo > 1 Then
	       		PageNo = PageNo - 1
			Else
				PageNo = 1
			End If

		 Case "下一页"
			If res.AbsolutePage < PageCount Then
				PageNo = PageNo + 1
			Else
				PageNo = PageCount
			End If

		Case "尾页"
			PageNo = PageCount

		Case "go!"
			PageNo = GotoPageNo

	    Case  Else
			PageNo = 1
	End Select
	
	res.AbsolutePage = PageNo
%>

	<div align="center"><center>

   <form Action="query.asp" Method="POST" name="form4">
	  <input type="hidden" name="tet" value="<%=tet%>">
	  <input type="hidden" name="R1" value="<%= R1 %>">
      <input type="hidden" name="PageNo" value="<%=PageNo%>">

	  <input TYPE="submit" Name="Mv" Value="首页" style="font-size: 9pt" <%If PageNo = 1 Then %>disabled<%End If %>> 
 
	  <input TYPE="submit" Name="Mv" Value="上一页" style="font-size: 9pt" <%If PageNo <= 1 Then %>disabled<%End If %>> 
 
	  <input TYPE="submit" Name="Mv" Value="下一页" style="font-size: 9pt" <%If PageNo >= PageCount Then %>disabled<%End If %>>

	  <input TYPE="submit" Name="Mv" Value="尾页" style="font-size: 9pt" <%If PageNo = PageCount Then %>disabled<%End If %>> 

	  &nbsp;&nbsp;&nbsp;&nbsp;
	  转到第<input name="GotoPageNo" size="4" value="<%=GotoPageNo%>">页
	  <input TYPE="submit" Name="Mv" Value="go!" style="font-size: 9pt" id=b_go LANGUAGE=javascript onclick="return b_go_onclick(form4,<%=PageCount%>)"> 


	  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第<%=PageNo%>页;共<%=PageCount%>页;共<%=res.recordcount%>条书目

   </form>




	<table border="0" width="75%" style="font-size: 9pt" align="center">

<% For j = 1 to res.PageSize %>

<%
	book_name=""
	if not isNull(res("丛书名")) then
		book_name="<b>"+res("丛书名")+":</b>"
	end if
	if not isNull(res("正书名")) then
		book_name=book_name+res("正书名")
	end if
	if not isNull(res("副书名")) then
		book_name=book_name+" -  "+res("副书名")
	end if
%>	

     <tr align="left">
         <td bgcolor="#e8e8ec"><a Href="title_detail.asp?XHBID=<%=res("XHBID")%>&amp;book_name=<%=book_name%>"><%=book_name%></a>
         &nbsp;&nbsp;&nbsp;<%if res("flag_new")="1" then%><img src="new.jpg" alt="new" WIDTH="22" HEIGHT="13"><%end if%>
         &nbsp;&nbsp;&nbsp;<%if res("flag_pre")="1" then%><img src="pre.jpg" alt="new" WIDTH="22" HEIGHT="13"><%end if%>
         </td>
     </tr>


     <tr align="left">
		<td bgcolor="#e8e8ec" align="left">

		价格:<FONT color=tomato><%=res("定价")%></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		折扣:<FONT color=tomato><%=res("折扣")%></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		备注:<FONT color=tomato><%=res("备注")%></FONT>

		</td>
     </tr>

     
     <tr align="left">
		<td bgcolor="#e8e8ec" align="left"><%=res("出版者")%>
		&nbsp;&nbsp;&nbsp;出版日期:<%=res("出版日期")%>
		&nbsp;&nbsp;&nbsp;点击数:<%=res("hits")%></td>
     </tr>

     <tr align="left">
		<td bgcolor="#e8e8ec" align="ledt">
		<form Action="gwc.asp" Method="POST" name="form2" LANGUAGE=javascript onsubmit="return form2_onsubmit(this)">
			<input type="hidden" name="ShopID" value="<%=Application("ZDID")%>">
			<input type="hidden" name="XHBID" value="<%=res("XHBID")%>">
			<input type="hidden" name="flag" value="new1">
			<input type="text" name="number" value="1" maxlength=3 size=3>册
			<input type="submit" name="b1" value="放进购物车" style="font-size: 9pt">
		</form>

		</td>
     </tr>

     <tr align="left">
     </tr>





<%
	 res.movenext
	 If res.EOF Then
		Exit For
	 End If
   Next 
%>
   </table>
   

   <form Action="query.asp" Method="POST" name="form3">
	  <input type="hidden" name="tet" value="<%=tet%>">
	  <input type="hidden" name="R1" value="<%= R1 %>">
      <input type="hidden" name="PageNo" value="<%=PageNo%>">

	  <input TYPE="submit" Name="Mv" Value="首页" style="font-size: 9pt" <%If PageNo = 1 Then %>disabled<%End If %>> 
 
	  <input TYPE="submit" Name="Mv" Value="上一页" style="font-size: 9pt" <%If PageNo <= 1 Then %>disabled<%End If %>> 
 
	  <input TYPE="submit" Name="Mv" Value="下一页" style="font-size: 9pt" <%If PageNo >= PageCount Then %>disabled<%End If %>>

	  <input TYPE="submit" Name="Mv" Value="尾页" style="font-size: 9pt" <%If PageNo = PageCount Then %>disabled<%End If %>> 

	  &nbsp;&nbsp;&nbsp;&nbsp;
	  转到第<input name="GotoPageNo" size="4" value="<%=GotoPageNo%>">页
	  <input TYPE="submit" Name="Mv" Value="go!" style="font-size: 9pt" id=b_go LANGUAGE=javascript onclick="return b_go_onclick(form3,<%=PageCount%>)"> 


	  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第<%=PageNo%>页;共<%=PageCount%>页;共<%=res.recordcount%>条书目

   </form>
   </center></div>

<%
end if  '"没有满足条件的图书 !"

res.close 
set res=nothing
con.Close
%>


</body>
</html>

⌨️ 快捷键说明

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