Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with ASP and Form in JavaScript 1

Status
Not open for further replies.

finnoscar

Technical User
Aug 17, 2002
55
0
0
GB
Could somebody help me sort this out. I need to add radio buttons to this script so that a user would have a choice of Small,medium or large and have the list of dogs meeting their choices returned as an ASP. I would be really grateful for as much help as possible

<%@ LANGUAGE = JavaScript%>
<HTML>
<BODY>
<TABLE BORDER=1>
<THEAD>
<TR>
<TH>Breed Name</TH>


<TH></TH>
</TR>
</THEAD>

<%
// Open connection to database, then populate a recordset with list of stock
var adoConnection = Server.CreateObject(&quot;ADODB.Connection&quot;);
var adoRecordSet;
var mySQL;
adoConnection.Open(&quot;DSN=DogDSN&quot;);
var mySQL = &quot;SELECT BreedName&quot; +
&quot; FROM Breeds&quot;;
adoRecordSet = adoConnection.Execute(mySQL);

// Loop through recordset and write Breed Names out to page
while ( adoRecordSet.Eof == false )
{
%>
<TR>
<TD><%=adoRecordSet(&quot;BreedName&quot;).Value%></TD>



</TR>
<%
adoRecordSet.MoveNext();
}

// Close Recordset and connections
// and release memory used by Recordset and Connection objects
adoRecordSet.Close();
adoRecordSet = null;
adoConnection.Close();
adoConnection = null;
%>
</TABLE>
</BODY>
</HTML>
 
This is my code in it's entirety and when I run it the radio buttons just clear and nothing is returned

<%@ LANGUAGE = &quot;JavaScript&quot;%>
<html>
<body>
<table border=&quot;1&quot;>
<%var str_DogSize = new String(Request.Form(&quot;DogSize&quot;));
var str_DogGrooming = new String(Request.Form(&quot;DogGrooming&quot;));
var str_DogExercise = new String(Request.Form(&quot;DogExercise&quot;));
var str_DogSpace = new String(Request.Form(&quot;DogSpace&quot;));
var str_DogFeed =new String(Request.Form(&quot;DogFeed&quot;));
if (str_DogSize!=&quot;undefined&quot; && str_DogGrooming!=&quot;undefined&quot; && str_DogExercise!=&quot;undefined&quot; &&
str_DogSpace!=&quot;undefined&quot; && str_DogFeed!=&quot;undefined&quot;){

%> <tr>
<td align=&quot;left&quot; style=&quot;font-weight:bold;&quot;>Breed Name</td>
</tr>
<% // Open connection to database, then populate a recordset with list of breeds
var adoConnection = Server.CreateObject(&quot;ADODB.Connection&quot;);
adoConnection.Open(&quot;DSN=DogDSN&quot;);
var mySQL = 'SELECT BreedName FROM Breeds ';
mySQL += 'WHERE Size=&quot;' + str_DogSize +'&quot;';
mySQL +='and Grooming=&quot;' +str_DogGrooming +'&quot;';
mySQL +='and ExerciseReq=&quot;' +str_DogExercise +'&quot;';
mySQL +='and SpaceReq=&quot;' +str_DogSpace +'&quot;';
mySQL +='and FeedingReq=&quot;' +str_DogFeed +'&quot;';
var adoRecordSet = adoConnection.Execute(mySQL);
// Loop through recordset and write Breed Names out to page
while (!adoRecordSet.Eof){
%> <tr>
<td><%=adoRecordSet.Fields(&quot;BreedName&quot;).Value%></td>
</tr>
<% adoRecordSet.MoveNext();
}
// Close Recordset and connections
// and release memory used by Recordset and Connection objects
adoRecordSet.Close();
adoRecordSet = null;
adoConnection.Close();
adoConnection = null;
}else{
%> <tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Breed Size: </td>
<td align=left>
<form method=&quot;post&quot;>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;S&quot;>Small<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;M&quot;>Medium<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;L&quot;>Large<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;XL&quot;>Giant<br>
<form>
</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Grooming Required: </td>
<td align=left>
<form method=&quot;post&quot;>
<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Con&quot;>Considerable<br>
</form>
</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Exercise Required: </td>
<td align=left>
<form method=&quot;post&quot;>
<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Con&quot;>Considerable<br>

</form>
</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Space Required: </td>
<td align=left>
<form method=&quot;post&quot;>
<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Con&quot;>Considerable<br>
<form>
</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Feeding Required: </td>
<td align=left>
<form method=&quot;post&quot;>
<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Con&quot;>Considerable<br>
<input type=&quot;submit&quot; value=&quot;Search&quot;>

<form>
</td>
</tr>

<%}
%>
</table>
</body>
</html>
 
ahhh .. put the <form> tag just after the <body> tag and the </form> tag just before the </body> tag - you only need one form.

Given you have a separate form for each radio group, but only a submit button on the last form, it is only ever submitting the DogFeed category. Putting form tags around the whole lot of the input tags means they'll all be submitted.

You have a dog yourself? codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
Now when I run it I get the message too few parameters.4 expected line 29 which is this line

var adoRecordSet = adoConnection.Execute(mySQL);

Yes,I have two Irish Wolfhounds.
 
If this were to run what way would it would it print the list of dogs out. I mean where on the page would they be printed out above the form,below it or beside it?
 
var mySQL = 'SELECT BreedName FROM Breeds ';
mySQL += 'WHERE Size=&quot;' + str_DogSize +'&quot; ';
mySQL +='and Grooming=&quot;' +str_DogGrooming +'&quot; ';
mySQL +='and ExerciseReq=&quot;' +str_DogExercise +'&quot; ';
mySQL +='and SpaceReq=&quot;' +str_DogSpace +'&quot; ';
mySQL +='and FeedingReq=&quot;' +str_DogFeed +'&quot; ';

needed to add some spaces in (as above).

the list will appear instead of the form. codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
I have it exactly as you've shown but I still get an error message saying:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 3.
/PickADog.asp, line 29

What's wrong?
 
How would I add a link to this page to take me back to the homepage or to other pages?
 
to debug, post the results of doing below:
//var adoRecordSet = adoConnection.Execute(mySQL);
Response.write(mySQL);
Response.End;

is this the homepage? if not:

adoConnection = null;
%> <tr>
<td>
<a href=&quot;homepage.asp&quot;>
Back to homepage
</a>
</td>
</tr>
<%}else{
%> <tr> codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
This is the way I inserted your code

<%@ LANGUAGE = &quot;JavaScript&quot;%>
<html>

<head>
<meta name=&quot;Microsoft Theme&quot; content=&quot;indust 110, default&quot;>
</head>

<body><table border=&quot;1&quot;>
<%var str_DogSize = new String(Request.Form(&quot;DogSize&quot;));
var str_DogGrooming = new String(Request.Form(&quot;DogGrooming&quot;));
var str_DogExercise = new String(Request.Form(&quot;DogExercise&quot;));
var str_DogSpace = new String(Request.Form(&quot;DogSpace&quot;));
var str_DogFeed =new String(Request.Form(&quot;DogFeed&quot;));
if (str_DogSize!=&quot;undefined&quot; && str_DogGrooming!=&quot;undefined&quot; && str_DogExercise!=&quot;undefined&quot; &&
str_DogSpace!=&quot;undefined&quot; && str_DogFeed!=&quot;undefined&quot;){

%> <tr>
<td align=&quot;left&quot; style=&quot;font-weight:bold;&quot;>Breed Name</td>
</tr>
<% // Open connection to database, then populate a recordset with list of breeds
var adoConnection = Server.CreateObject(&quot;ADODB.Connection&quot;);
adoConnection.Open(&quot;DSN=DogDSN&quot;);
var mySQL = 'SELECT BreedName FROM Breeds ';
mySQL += 'WHERE Size=&quot;' + str_DogSize +'&quot; ';
mySQL += 'and Grooming=&quot;' +str_DogGrooming +'&quot; ';
mySQL += 'and ExerciseReq=&quot;' +str_DogExercise +'&quot; ';
mySQL += 'and SpaceReq=&quot;' +str_DogSpace +'&quot; ';
mySQL += 'and FeedingReq=&quot;' +str_DogFeed +'&quot; ';
var adoRecordSet = adoConnection.Execute(mySQL);
// Loop through recordset and write Breed Names out to page
while (!adoRecordSet.Eof){
%> <tr>
<td><%=adoRecordSet.Fields(&quot;BreedName&quot;).Value%></td>
</tr>
<% adoRecordSet.MoveNext();
}
// Close Recordset and connections
// and release memory used by Recordset and Connection objects
adoRecordSet.Close();
adoRecordSet = null;
adoConnection.Close();
adoConnection = null;
}else{
%> <tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Breed Size:</td>
<td align=left>
<form method=&quot;post&quot;>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;S&quot;>Small<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;M&quot;>Medium<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;L&quot;>Large<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;XL&quot;>Giant<br>

</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Grooming Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Con&quot;>Considerable<br>

</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Exercise Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Con&quot;>Considerable<br>


</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Space Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Con&quot;>Considerable<br>

</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Feeding Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Con&quot;>Considerable<br>
<input type=&quot;submit&quot; value=&quot;Search&quot;>

<form>
</td>
</tr>

<%}
%>
<% //var adoRecordSet = adoConnection.Execute(mySQL);
Response.write(mySQL);
Response.End;

is this the homepage? if not:

adoConnection = null;
%> <tr>
<td>
<a href=&quot;homepage.asp&quot;>
Back to homepage
</a>
</td>
</tr>
<%}else{
%>
</table></body>
</html>

and this is the message it returns

Error Type:
Microsoft JScript compilation (0x800A03EC)
Expected ';'
/PickADog.asp, line 105, column 3
is this the homepage? if not:
--^
I don't know if I have inserted the code correctly or not
 
ANSWER 1:
//var adoRecordSet = adoConnection.Execute(mySQL); <-- this is a line of your code i commented out to show ou how to debug
Response.write(mySQL); // <-- this is a line i added to output the query to the screen
Response.End; // <-- this is a line i added to stop page execution after outputting the query

the above lines of code are meant to be inserted after the (now commented out) line in your code listed above.

codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
ANSWER 2 - if the 'homepage' you refer to is not the current page (the page listing the breeds), you can add the code below (NOTE as in post above, code is meant to be inserted into your code between the lines of your code you recognise below)

adoConnection = null;
%> <tr>
<td>
<a href=&quot;homepage.asp&quot;>
Back to homepage
</a>
</td>
</tr>
<%}else{
%> <tr> codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
How would I insert a key on the right hand side of the page to let users know what each of the categories they are picking means?
 
Breed Name SELECT BreedName FROM Breeds WHERE Size=&quot;L&quot; and Grooming=&quot;Mod&quot; and ExerciseReq=&quot;Mod&quot; and SpaceReq=&quot;Mod&quot; and FeedingReq=&quot;Mod&quot;

This is what is returned when I pick these radio buttons and submit it
 
and now if you comment out the
Response.write(mySQL);
and
Response.End;
lines and uncomment the
//var adoRecordSet = adoConnection.Execute(mySQL);
line, what happens?

if it still gives a Too Few Parameters error, it's likely wrongly named table fields, or trying to use wrong data types as criteria.
codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
<%@ LANGUAGE = &quot;JavaScript&quot;%>
<html>

<head>
<meta name=&quot;Microsoft Theme&quot; content=&quot;indust 110, default&quot;>
</head>

<body><table border=&quot;1&quot;>
<%var str_DogSize = new String(Request.Form(&quot;DogSize&quot;));
var str_DogGrooming = new String(Request.Form(&quot;DogGrooming&quot;));
var str_DogExercise = new String(Request.Form(&quot;DogExercise&quot;));
var str_DogSpace = new String(Request.Form(&quot;DogSpace&quot;));
var str_DogFeed =new String(Request.Form(&quot;DogFeed&quot;));
if (str_DogSize!=&quot;undefined&quot; && str_DogGrooming!=&quot;undefined&quot; && str_DogExercise!=&quot;undefined&quot; &&
str_DogSpace!=&quot;undefined&quot; && str_DogFeed!=&quot;undefined&quot;){

%> <tr>
<td align=&quot;left&quot; style=&quot;font-weight:bold;&quot;>Breed Name</td>
</tr>
<% // Open connection to database, then populate a recordset with list of breeds
var adoConnection = Server.CreateObject(&quot;ADODB.Connection&quot;);
adoConnection.Open(&quot;DSN=DogDSN&quot;);
var mySQL = 'SELECT BreedName FROM Breeds ';
mySQL += 'WHERE Size=&quot;' + str_DogSize +'&quot; ';
mySQL += 'and Grooming=&quot;' +str_DogGrooming +'&quot; ';
mySQL += 'and ExerciseReq=&quot;' +str_DogExercise +'&quot; ';
mySQL += 'and SpaceReq=&quot;' +str_DogSpace +'&quot; ';
mySQL += 'and FeedingReq=&quot;' +str_DogFeed +'&quot; ';
var adoRecordSet = adoConnection.Execute(mySQL);
// Loop through recordset and write Breed Names out to page
while (!adoRecordSet.Eof){
%> <tr>
<td><%=adoRecordSet.Fields(&quot;BreedName&quot;).Value%></td>
</tr>
<% adoRecordSet.MoveNext();
}
// Close Recordset and connections
// and release memory used by Recordset and Connection objects
adoRecordSet.Close();
adoRecordSet = null;
adoConnection.Close();
adoConnection = null;
}else{
%> <tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Breed Size refers to ...</td>
<td valign=&quot;top&quot; align=&quot;right&quot;>Breed Size:</td>
<td align=left>
<form method=&quot;post&quot;>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;S&quot;>Small<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;M&quot;>Medium<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;L&quot;>Large<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;XL&quot;>Giant<br>

</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Grooming Required refers to ...</td> <td valign=&quot;top&quot; align=&quot;right&quot;>Grooming Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Con&quot;>Considerable<br>

</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Exercise Required refers to ...</td> <td valign=&quot;top&quot; align=&quot;right&quot;>Exercise Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Con&quot;>Considerable<br>


</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Space Required refers to ...</td> <td valign=&quot;top&quot; align=&quot;right&quot;>Space Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Con&quot;>Considerable<br>

</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Feeding Required refers to ...</td> <td valign=&quot;top&quot; align=&quot;right&quot;>Feeding Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Con&quot;>Considerable<br>
<input type=&quot;submit&quot; value=&quot;Search&quot;>

<form>
</td>
</tr>

<%}
%> <tr>
<td colspan=&quot;2&quot;>
<a href=&quot;homepage.asp&quot;>
Back to homepage
</a>
</td>
</tr>
<%}else{
%>
</table></body>
</html>

I've got Aussie Shepherds :) codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
Thanks a million codestorm you've been a life saver.
 
One of the table fields was incorrectly named and when I corrected it the error message changed to:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/PickADog.asp, line 29

They are all text fields apart from the BreedName which is a hyperlink
 
One of the table fields was incorrectly named and when I corrected it the error message changed to:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/PickADog.asp, line 29

They are all text fields apart from the BreedName which is a hyperlink
 
This is the code exactly as I have it now



<html>

<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;>
<meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;>
<meta name=&quot;Microsoft Theme&quot; content=&quot;indust 110, default&quot;>
</head>

<body><%@ LANGUAGE = &quot;JavaScript&quot;%>
<table border=&quot;1&quot;>
<%var str_DogSize = new String(Request.Form(&quot;DogSize&quot;));
var str_DogGrooming = new String(Request.Form(&quot;DogGrooming&quot;));
var str_DogExercise = new String(Request.Form(&quot;DogExercise&quot;));
var str_DogSpace = new String(Request.Form(&quot;DogSpace&quot;));
var str_DogFeed =new String(Request.Form(&quot;DogFeed&quot;));
if (str_DogSize!=&quot;undefined&quot; && str_DogGrooming!=&quot;undefined&quot; && str_DogExercise!=&quot;undefined&quot; &&
str_DogSpace!=&quot;undefined&quot; && str_DogFeed!=&quot;undefined&quot;){

%> <tr>
<td align=&quot;left&quot; style=&quot;font-weight:bold;&quot;>Breed Name</td>
</tr>
<% // Open connection to database, then populate a recordset with list of breeds
var adoConnection = Server.CreateObject(&quot;ADODB.Connection&quot;);
adoConnection.Open(&quot;DSN=DogDSN&quot;);
var mySQL = 'SELECT BreedName FROM Breeds ';
mySQL += 'WHERE Size=&quot;' + str_DogSize +'&quot; ';
mySQL += 'and Grooming=&quot;' +str_DogGrooming +'&quot; ';
mySQL += 'and Exercise=&quot;' +str_DogExercise +'&quot; ';
mySQL += 'and SpaceReq=&quot;' +str_DogSpace +'&quot; ';
mySQL += 'and FeedingReq=&quot;' +str_DogFeed +'&quot; ';
var adoRecordSet = adoConnection.Execute(mySQL);
// Loop through recordset and write Breed Names out to page
while (!adoRecordSet.Eof){
%> <tr>
<td><%=adoRecordSet.Fields(&quot;BreedName&quot;).Value%></td>
</tr>
<% adoRecordSet.MoveNext();
}
// Close Recordset and connections
// and release memory used by Recordset and Connection objects
adoRecordSet.Close();
adoRecordSet = null;
adoConnection.Close();
adoConnection = null;
}else{
%> <tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Breed Size refers to ...</td>
<td valign=&quot;top&quot; align=&quot;right&quot;>Breed Size:</td>
<td align=left>
<form method=&quot;post&quot;>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;S&quot;>Small<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;M&quot;>Medium<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;L&quot;>Large<br>
<input type=&quot;radio&quot; name=&quot;DogSize&quot; value=&quot;XL&quot;>Giant<br>

</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Grooming Required refers to ...</td> <td valign=&quot;top&quot; align=&quot;right&quot;>Grooming Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogGrooming&quot; value=&quot;Con&quot;>Considerable<br>

</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Exercise Required refers to ...</td> <td valign=&quot;top&quot; align=&quot;right&quot;>Exercise Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogExercise&quot; value=&quot;Con&quot;>Considerable<br>


</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Space Required refers to ...</td> <td valign=&quot;top&quot; align=&quot;right&quot;>Space Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogSpace&quot; value=&quot;Con&quot;>Considerable<br>

</td>
</tr>
<tr>
<td valign=&quot;top&quot; align=&quot;right&quot;>Feeding Required refers to ...</td> <td valign=&quot;top&quot; align=&quot;right&quot;>Feeding Required:</td>
<td align=left>

<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Lt&quot;>Little<br>
<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Mod&quot;>Moderate<br>
<input type=&quot;radio&quot; name=&quot;DogFeed&quot; value=&quot;Con&quot;>Considerable<br>
<input type=&quot;submit&quot; value=&quot;Search&quot;>

<form>
</td>
</tr>

<%}
%> <tr>
<td colspan=&quot;2&quot;>
<a href=&quot;homepage.asp&quot;>
Back to homepage
</a>
</td>
</tr>
<%
%>
</table></body>
</html>

I am still receiving the same error message and all the field names are correct and the data types are all text
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top