📄 search.asp
字号:
<%
Dim Kind, Keyword
Kind = Request("Kind") '读取浏览者所选择的搜索类别
Keyword = Request("Keyword") '读取浏览者所输入的关键字
if Keyword="" then
response.Redirect("booksearch.htm")
end if
%>
<HTML>
<head><title>查询结果</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<BODY background="back.gif">
<!-- #include file="ADOFunctions.asp" -->
<%
'根据搜索类别及关键字对“书目库”数据表做查询,结果存放在objRS对象中
Dim objRS, strSQL,a
strSQL = "SELECT * FROM 书目库 WHERE " & Kind & " LIKE '%" & Keyword & "%'"
Set objRS = GetSQLRecordset(strSQL, "book.mdb", "书目库")
a=0
Do While Not objRS.EOF
For I = 0 To objRS.Fields.Count - 1
a=a+1
next
objRS.MoveNext
loop
a=a/5
response.write " <p>"
response.write "      检索"
response.write "〖"
response.write "<font color=green>"
response.write ""& Kind
response.write "</font>"
response.write "〗"
response.write "<font color=red>"
response.write ""&Keyword
response.write "</font>"
response.write "  命中"
response.write "<font color=blue>"
response.write ""&a
response.write "</font>"
response.write "条记录"
response.write "</p>"
%>
<TABLE BORDER="1" width="90%" align="center" cellpadding="1" cellspacing="0" bordercolor="#7784D7">
<TR>
<%
'读取数据表的字段名称以作为表格的标题
For I = 0 To objRS.Fields.Count - 1
Response.Write "<TH>" & objRS.Fields(I).Name & "</TH>"
Next
%>
</TR>
<%
'读取并显示各个字段数据
Dim objRSD, strSQLD
strSQLD = "SELECT * FROM 书目库 WHERE " & Kind & " LIKE '%" & Keyword & "%'"
Set objRSD = GetSQLRecordset(strSQL, "book.mdb", "书目库")
Do While Not objRSD.EOF
Data = "<TR>"
For I = 0 To objRSD.Fields.Count - 1
if I=objRSD.Fields.Count - 1 then
Data = Data & "<TD width=105>" & objRSD.Fields(I).Value & "</TD>"
elseif I=objRSD.Fields.Count - 2 then
Data = Data & "<TD width=72>" & objRSD.Fields(I).Value & "</TD>"
else
Data = Data & "<TD>" & objRSD.Fields(I).Value & "</TD>"
end if
Next
Response.Write Data & "</TR>"
objRSD.MoveNext
Loop
'关闭数据库连接并释放对象
objRS.Close
Set objRSD= Nothing
objConn.Close
Set objConn = Nothing
%>
</TABLE>
<TABLE width="90%" height="30" BORDER="0" align="center" cellpadding="1" cellspacing="0" bordercolor="#7784D7" high="20">
<tr>
<td align="center" valign="bottom"><a href="booksearch.HTM"><img src=return.gif width="40" height="20" border="0"></a></td>
</tr>
</TABLE>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -