taylorantone
MIS
I created some pages in FrontPage and I wanted to change some things, but just like it does with regular HTML, FrontPage seems to bloat everything and the ASP isn't what I would expect it to be.
I had an ASP page that used a single drop-down box populated from a column in my database, then used the selection in that drop-down to show the results below--not on a 2nd page.
With the FrontPage version, I had the SQL string with two parameters WHERE (field = ':aram1::') ORDER BY :aram2::
The page would default to displaying no records and would say so just below the table header row ("No matching records").
I have re-written the page by hand but am having trouble with those two parameters. Since no defaults are specified (I don't know how to do this) and also since I don't have any code in the database that returns a custom error message, when I try to open the page I receive:
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/misc/asp/testsearh.asp, line 23
So, my questions are as follows:
1. How do I specify defaults for the two parameters so that the page comes up properly and allows me to use the drop-down box to make a selection and have the results display below it?
2. How do I tell the page to display "No matching records" if BOTH the parameter is missing or if the selection made in the drop-down box produces no results?
Here's the page code:
I had an ASP page that used a single drop-down box populated from a column in my database, then used the selection in that drop-down to show the results below--not on a 2nd page.
With the FrontPage version, I had the SQL string with two parameters WHERE (field = ':aram1::') ORDER BY :aram2::
The page would default to displaying no records and would say so just below the table header row ("No matching records").
I have re-written the page by hand but am having trouble with those two parameters. Since no defaults are specified (I don't know how to do this) and also since I don't have any code in the database that returns a custom error message, when I try to open the page I receive:
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/misc/asp/testsearh.asp, line 23
So, my questions are as follows:
1. How do I specify defaults for the two parameters so that the page comes up properly and allows me to use the drop-down box to make a selection and have the results display below it?
2. How do I tell the page to display "No matching records" if BOTH the parameter is missing or if the selection made in the drop-down box produces no results?
Here's the page code:
Code:
<html>
<head>
<title>Genre Search</title>
</head>
<body>
<%
dim oRSgenres
dim oRSqrydvdlistbygenre
set oRSGenres = Server.CreateObject("ADODB.Recordset")
set oRSqrydvdlistbygenre = Server.CreateObject("ADODB.Recordset")
sqlGenres = "SELECT * FROM tblGenres ORDER BY genre ASC;"
sqlqrydvdlistbygenre = "SELECT * FROM qrydvdlistbygenre WHERE genre = 'Foreign' ORDER BY title ASC;"
oRSgenres.open sqlGenres, "DSN=dvdlist"
oRSgenres.MoveFirst
oRSqrydvdlistbygenre.open sqlqrydvdlistbygenre, "DSN=dvdlist"
oRSqrydvdlistbygenre.MoveFirst
%>
<form method="get" action="testgenresearch.asp" onsubmit="return frmsearchgenre_Validator(this)" name="frmsearchgenre">
<b><font size="2">Choose a Genre</font></b><br>
<select name="selgenre" onchange=frmsearchgenre.submit() size="1">
<option selected value=""><%Request.Form("genre")%></option>
<%
Do While NOT oRSgenres.EOF
Response.Write "<option value='" & oRSgenres("genreID") & "'>" & oRSgenres("genre") & "</option>"
oRSgenres.MoveNext
Loop
%>
</select>
</form>
<i><font size="2">See more detailed movie information at <a target="_blank" href="[URL unfurl="true"]http://www.allmovie.com">All[/URL] Movie Guide</a></font></i>
<br><br>
<table width="100%" border="0" cellpadding="0" cellspacing="0" height="74">
<th>
<tr>
<td bgcolor="#4E6BA3" width="243" height="19"><b><font color="#FFFFFF">Title</font></b></td>
<td bgcolor="#4E6BA3" width="225" height="19"><b><font color="#FFFFFF">Notes</font></b></td>
<td bgcolor="#4E6BA3" width="178" height="19"><b><font color="#FFFFFF">Genres</font></b></td>
<td bgcolor="#4E6BA3" width="51" height="19"><b><font color="#FFFFFF">Year</font></b></td>
<td bgcolor="#4E6BA3" width="51" height="19"><b><font color="#FFFFFF">In</font></b></td>
</tr>
</th>
<%
Do While NOT oRSqrydvdlistbygenre.EOF
%>
<%
Dim x, varbgcolor
if x = 1 then
varbgcolor="#C0C0C0"
x=2
Else
varbgcolor="#FFFFFF"
x=1
End if
%>
<tr>
<td bgcolor="<%=varbgcolor%>" width="243"><font size="2"><b><%=oRSqrydvdlistbygenre("title")%></b></font></td>
<td bgcolor="<%=varbgcolor%>" width="225"><font size="2"><i><%=oRSqrydvdlistbygenre("notes")%></i></font></td>
<td bgcolor="<%=varbgcolor%>" width="178"><font size="2"><%=oRSqrydvdlistbygenre("genres")%></font></td>
<td bgcolor="<%=varbgcolor%>" width="51"><font size="2"><%=oRSqrydvdlistbygenre("year")%></font></td>
<td bgcolor="<%=varbgcolor%>" width="51"><font size="2"><%=oRSqrydvdlistbygenre("year")%></font></td>
</tr>
<%
oRSqrydvdlistbygenre.MoveNext
Loop
%>
</table>
</body>
</html>