ASP page results not loading - please help!
by Mike Henden <mike.henden(at)xtra.co.nz>
|
Date: |
Wed, 15 Aug 2001 13:39:44 +1200 |
To: |
HWG techniques <hwg-techniques(at)mail.hwg.org> |
|
todo: View
Thread,
Original
|
|
Many thanks for the help I have received from members of this group
in de-bugging the code on this page. With your help, despite being
ASP-challenged I have succeeded in getting the page to load in a test
environment, and am now down to one (major) problem, i.e. I can't get
the page to write the results of the database search!
As I understand it, this script will search a database for any given
words -- by which I mean that you don't need to know the complete
title of the book or author in order to get a 'hit'. Can anyone
confirm this? Doesn't seen to make much difference -- I've tried the
page with a keyword and with a complete title to no avail!
Can any ASP Gurus out there shed any light on my dilemma?
T.I.A
MIKE
==========================================================
CODE FOLLOWS
<%
'Open database
set objDB = Server.CreateObject("ADODB.Connection")
objDB.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA
SOURCE=d:\sitehosting\accountname\_database\booklist.mdb"
%>
<html><head><title> template</title>
<body>
<!-- page data goes here -->
<table width=550 border=0 cellpadding=3 cellspacing=0>
<tr><td height=160 valign=bottom colspan=2>
<img src="../images/heads/whatsnew.JPG" alt="What's
New" align=top width="550" height="114" border="0">
</td></tr>
<tr>
<td colspan=2>
<form method=post action="booklist-test.asp#results" id=search name=search>
<h2>Search the Library:</h2>
<%
'work with database
IF Request.Form("Field")="" THEN
Caption = "A list of publications available:"
Query = "SELECT * FROM aklbook"
ELSE
Caption = " (<a href=booklist-test.asp>View all publications</a>):"
Text = Server.HTMLEncode(Request.Form("Text"))
Query = "SELECT * FROM Tips WHERE " & Request.Form("Field") & " LIKE
'%" & Text & "%' AND subDate>'" & Request.Form("Start") & "' AND
subdate<'" & Request.Form("End") & "'"
END IF
%>
</td>
</tr>
<tr>
<td>
<div align=left class="body">Search by:</div>
</td>
<td>
<select name="pulldown">
<option value="Title">Title</option>
<option value="Author">Author</option>
<option value="PublisherName">Publisher</option>
<option value="PublicationDate">Publication Date</option>
</select>
</td>
</tr>
<tr>
<td>
<div align=left class="body">Search for:</div>
</td>
<td>
<input type="Text" id=text name=text size=40>
</td>
</tr>
<tr>
<td><div align=left class="body">Search from:</div></td>
<td><input type="text" id=start name=start value="<%=
StartDate%>" size=10>
<span align=left class="body"> to: </span>
<input type="text" id=end name=end value="<%= EndDate%>" size=10>
</td>
</tr>
<tr>
<td colspan=2>
<br>
<input type="submit" value="Submit" id=submit1 name=submit1>
<input type="reset" value="Reset" id=reset1 name=reset1>
</form>
<a name=results>
<table border=0>
<caption><%=caption%></caption>
<%
while not rs.eof
response.write vbnewline
response.write "<tr><td>" & RS("Title")
response.write "</td><td>" & RS("Author")
response.write "</td><td>" & RS("PublisherName")
response.write "</td><td>" & RS("YearofPublication")
response.write "</td></tr>"
RS.MoveNext
WEND
%>
</table>
</td>
</tr>
</table>
<!-- page data table ends here -->
</td></tr>
</table>
</table>
</body>
</html>
<&
'Close database and destroy object
objDB.Close
set objDB = nothing
%>
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA