?? bookclass.asp
字號:
<%
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="200">出版社</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="100" >管理 <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 + -