View Single Post
  #1 (permalink)  
Old March 13th, 2004, 08:15 PM
darkhalf darkhalf is offline
Friend of Wrox
Join Date: Mar 2004
Location: Ottawa, , Canada.
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inconsistent error when retrieving data from a db

I sometimes get this error, but after a few tries it works, I don't understand what I'm doing wrong.

Error Type:
Provider (0x80004005)
Unspecified error
/cookbook/search.asp, line 109

here is the code...

<script language="JavaScript">
function SetInfo_href(url)
href = new Array ('A-F','G-L','M-R','S-Z','all');
s = document.Search;
s.search_field.value = "alpha="+href[url];
function SetInfo()
s = document.Search;
meal = s.meal.value;
category = s.category.options[s.category.selectedIndex].value;
ingredients = s.ingredients.value;

if (meal != "")
s.search_field.value = "meal="+meal;
else if (category != "")
s.search_field.value = "category="+category;
else if (ingredients != "")
s.search_field.value = "ingredients="+ingredients;
function submit_recipe(ID)
document.SS.recipe_name.value = ID;
// document.write (ID)
<form name="Search" method="post" action="search.asp">
<td>Name of meal:</td>
<td><input type="text" name="meal" size="14"></td>
<td><select name="category">
<option value=""></option>
<option value="Appitizer">Appitizer</option>
<option value="Bread">Bread</option>
<option value="Breakfast">Breakfast</option>
<option value="Desert">Desert</option>
<option value="MainCourse">Main Course</option>
<option value="Soups">Soups</option>
<option value="Other">Other</option>
<td><input type="text" name="ingredients" size="14"></td>
<td colspan="2" align="center">
<a href="java_script_:SetInfo_href(0)">A-F</a> |
<a href="java_script_:SetInfo_href(1)">G-L</a> |
<a href="java_script_:SetInfo_href(2)">M-R</a> |
<a href="java_script_:SetInfo_href(3)">S-Z</a>
<td colspan="2" align="center"><a href="java_script_:SetInfo_href(4)">All</a></td>
<td colspan="2" align="center"><input type="button" value="Submit" onClick="SetInfo()"></td>
<td colspan="2" align="center"><input type="hidden" value="" name="search_field"></td>
search_string = Request.Form("search_field")
if IsEmpty(search_string) = TRUE then
arrsearch = Split(search_string,"=")
Select Case arrsearch(0)
Case "meal"
query = "SELECT * FROM Recipe WHERE R_name='"&arrsearch(1)&"'"
Case "category"
query = "SELECT * FROM Recipe WHERE R_category='"&arrsearch(1)&"'"
Case "ingredients"
query = "SELECT * FROM Recipe WHERE R_ingredients LIKE '%"&arrsearch(1)&"%'"
end Select
Set db = Server.CreateObject("ADODB.Connection") "Cookbook"

Set rs = db.Execute (query)

if rs.EOF and rs.BOF then
Response.Write("There are no recipes that match that criteria")
while not rs.EOF
Response.Write ("<a href=java_script_:submit_recipe("&rs("ID")&")>"&rs ("R_name")&"</a>")
end if

end if
<form name="SS" method="post" action="display.asp">
<input type="hidden" name="recipe_name" value="">

Reply With Quote