📄 bookclass.asp
字号:
<%
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
Class BookManagerClass
Public ID '记录ID号
Public bookid '书籍馆藏号
Public isbn 'ISBN
Public bookname '书名
Public bookauthor '作者
Public publishname '出版社
Public bookcount '复本数
Public languageType '语种
Public booktype '文献类型
Public bookedition '版次
Public Actionconn '数据库连接
Public Keyword '关键字
'BookManagerClass的私有属性
Private action
Private idd
'构造函数
Private Sub Class_initialize
Reset()
End Sub
'解析函数
Private Sub Class_terminate
Reset()
ActionConn.close
Set ActionConn=Nothing
End Sub
'重置属性(初始化属性)
Public Sub Reset()
ID=0
bookid=""
isbn=""
bookname=""
bookauthor=""
publishname=""
bookcount=1
booktype=""
bookedition=1
Keyword=""
action=Request.QueryString("action")
End Sub
'# ----------------------------------------------------------------------------
'# 函数:pagehtmlForm
'# 描述:显示表单页面
'# 参数: -
'# 返回:html代码
'#-----------------------------------------------------------------------------
Private Function PageHtmlForm()
%>
<div align="center"><form method="POST" action="?action=<%=action%>&id=<%=Id%>" name="myform">
<table border="0" width="300" id="table1" cellspacing="1">
<tr>
<td align="center" colspan="2" bgcolor="#006699">
<font color="#FFFFFF">书籍信息<%if Request("action")="add" then
Response.write "添加"
else
Response.write "修改"
end if%></font></td>
</tr>
<tr>
<td align="right" width="87">馆藏号</td>
<td width="204">
<input type="text" name="bookid" size="26" value="<%=bookid%>"></td>
</tr>
<tr>
<td align="right" width="87">ISBN</td>
<td width="204">
<input type="text" name="isbn" size="26" value="<%=isbn%>"></td>
</tr>
<tr>
<td align="right" width="87">书名</td>
<td width="204">
<input type="text" name="bookname" size="26" value="<%=bookname%>"></td>
</tr>
<tr>
<td align="right" width="87">作者</td>
<td width="204">
<input type="text" name="bookauthor" size="26" value="<%=bookauthor%>"></td>
</tr>
<tr>
<td align="right" width="87">出版社</td>
<td width="204">
<input type="text" name="publishname" size="26" value="<%=publishname%>"></td>
</tr>
<tr>
<td align="right" width="87">复本数</td>
<td width="204">
<input type="text" name="bookcount" size="26" value="<%=bookcount%>"></td>
</tr>
<tr>
<td align="right" width="87">语种</td>
<td width="204">
<select size="1" name="languagetype" class="Formtext">
<option value="汉语" <%if trim(languagetype)="汉语" then %>selected<%end if%>>汉语</option>
<option value="英语" <%if trim(languagetype)="英语" then %>selected<%end if%>>英语</option>
<option value="法语" <%if trim(languagetype)="法语" then %>selected<%end if%>>法语</option>
<option value="俄语" <%if trim(languagetype)="俄语" then %>selected<%end if%>>俄语</option>
<option value="韩语" <%if trim(languagetype)="韩语" then %>selected<%end if%>>韩语</option>
<option value="日语" <%if trim(languagetype)="日语" then %>selected<%end if%>>日语</option>
</select></td>
</tr>
<tr>
<td align="right" width="87">文献类型</td>
<td width="204"><select size="1" name="booktype" class="Formtext"><%SetSelected(1)%></select></td>
</tr>
<tr>
<td align="right" width="87">版次</td>
<td width="204">
<select size="1" name="bookedition" class="Formtext"><%SetSelected(2)%></select></td>
</tr>
<tr>
<td width="291" colspan="2" align="right">
<input type="submit" value=
<%If action="add" Then
Response.Write "添加书籍信息"
ElseIf action="modify" Then
Response.Write "修改书籍信息"
End if
%> name="B3" class="FormText">
<input type="button" value="返回列表" name="B2" onclick="location.href='?action=list';" class="FormText"> </td>
</table></form>
</div>
<%
End Function
'# ----------------------------------------------------------------------------
'# 函数:SetSelected
'# 描述:书籍语种、书籍类型、版次获取函数
'# 参数: -
'# 返回:HTML
'#-----------------------------------------------------------------------------
Private Function SetSelected(op)
Dim i
i=1
if op=2 then
do while i<11 %>
<option value="<%=i%>" <%if bookedition=i then%>selected<%end if%>><%=i%></option>"
<%i=i+1
loop
end if
if op=1 then
'获取书籍类型
Dim Rs,Sql
Set Rs=Server.Createobject("Adodb.Recordset")
Sql="Select BookTypeName From BooktypeInfo"
Rs.Open Sql,Actionconn,3,2
do while not Rs.eof %>
<option value="<%=Rs("BookTypeName")%>" <%if BookType=Rs("BookTypeName") then %>selected<%end if%>><%=Rs("BookTypeName")%></option>
<%Rs.movenext
loop
Rs.Close
set Rs=nothing
end if
End Function
'# ----------------------------------------------------------------------------
'# 函数:PageHtmlList
'# 描述:书籍信息列表页面
'# 参数: -
'# 返回:HTML
'#-----------------------------------------------------------------------------
Private Function PageHtmlList()
Dim sMathod,sKey,condition
sKey=Request("key")
sMathod=Request("fw")
select Case sMathod
Case "bid" condition=" where bookid "
Case "bname" condition=" where bookname "
Case "bauthor" condition=" where bookauthor "
Case "bpublish" condition=" where publishname "
Case "blanguage" condition=" where languageType "
Case "btype" condition=" where bookType "
end select
if condition<>"" then
condition=condition+" like '%"&sKey&"%'"
end if
%>
<div align="center">
<form method="post" action="?action=list" name="ListForm">
<table width=98% style="border:0px" class="table" cellpadding=0 cellspacing=0>
<tr>
<td class="td" align=right>查询方式:
<select class="select" name="fw" size="1">
<option value="bid">馆藏号</option>
<option value="bname">书名</option>
<option value="bauthor">作者</option>
<option value="bpublish">出版社</option>
<option value="blanguage">语种</option>
<option value="btype">文献类型</option>
</select>
输入关键字:
<input type="text" name="key" class="text" value="">
<input type="submit" class="button" value="搜索">
</td>
</tr>
</table>
</form>
</div>
<form method="post" action="?action=delete" name="delForm">
<div align="center">
<table width=98% border=1 class="table" cellpadding=0 cellspacing=0>
<tr class="headtr">
<td class="td" height="23" align="center" width="80">馆藏号</td>
<td class="td" height="23" align="center" width="100">ISBN</td>
<td class="td" height="23" align="center" width="150">书名</td>
<td class="td" height="23" align="center" width="80">作者</td>
<td class="td" height="23" align="center" width="180">出版社</td>
<td class="td" height="23" align="center" width="80">复本数</td>
<td class="td" height="23" align="center" width="60">语种</td>
<td class="td" height="23" align="center" width="150">文献类型</td>
<td class="td" height="23" align="center" width="80">版次</td>
<td class="td" height="23" align="center" width="120" >管理 <input type="submit" class="button" value="删除" name="b1"></td>
</tr>
<%
Dim Rs,Sql
Set Rs=Server.Createobject("Adodb.Recordset")
Sql="Select * From BookInfo "&condition&" order by bookid"
Rs.Open Sql,Actionconn,3,2
Do While not Rs.eof
ID=Rs("ID")
bookid=Rs("bookid")
isbn=Rs("isbn")
bookname=Rs("bookname")
bookauthor=Rs("bookauthor")
publishname=Rs("publishname")
bookcount=Rs("bookscount")
languageType=Rs("languageType")
booktype=Rs("booktype")
bookedition=Rs("bookedition")
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -