| hwg-techniques archives | Aug 2001 | new search | results | previous | next |
How is the date stored? 1/2/2001 or 1/2/2001 10:58 PM
Are the date fields datetime datatypes?
If you are testing actual date values you need to wrap the dates in #
instead of ':
#" & Request.Form("End") & "#
Also with dates, you may need to specify the time:
subDate > '" & Request.Form("Start") & " 12:00 AM' AND subdate < '" &
Request.Form("End") & " 11:59 PM'
If you are insterting the date into a field of datetime datatype it
usually adds 12:00 AM to the end to make it a complete datetime then if
you compare the datetime with out the time it will never find it.
This is just from my own experience.
************************
Mike Carlson
http://www.domitianx.com
domitianx(at)domitianx.com
************************
-----Original Message-----
From: owner-hwg-techniques(at)hwg.org [mailto:owner-hwg-techniques(at)hwg.org]
On Behalf Of Mike Henden
Sent: Tuesday, August 14, 2001 8:40 PM
To: HWG techniques
Subject: ASP page results not loading - please help!
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