set RSBooks = conn.Execute("select BookID, Author, Title, Subject from LibBooks where " _
& Request.Form("SearchField") & " Like '%" & Request.Form("SearchCriteria") & "%'")
注意:,符号%表示的是一个广义搜索。这一点类似于ACCESS中的符号*。
然后将所找到的书以表格形式显示出来。代码如下:
<% Do Until RSBooks.EOF %>
<TR VALIGN="top" ALIGN="left">
<TD WIDTH=40% height="20"><B>书名:</B> <A HREF="../html/book.asp?BookID=<% Response.Write RSBooks("BookID") %>"><% Response.Write RSBooks("Title") %></A></TD>
<td width=20% height="20"><B>著者:</B> <% Response.Write RSBooks("Author") %></td>
<td width=30% height="20"><B>主题:</B> <% Response.Write RSBooks("Subject") %> </td>
<% RSBooks.MoveNext
Loop %>
图书页面
图书页面的代码显示图书的有关信息,以及管理图书的出借操作。
该页面通过Querystring 传递BookID
if isempty(Request.QueryString("BookID")) then
Response.Redirect "./search.html"
end if
如果其中不存在,则访问者将被重定向到搜索页面:
如果同时传递表单中包含的变量Action不为空,则表明访问者正借阅该图书:
if Not isempty(Request.QueryString("Action")) then
|