Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 13th, 2004, 08:15 PM
Friend of Wrox
 
Join Date: Mar 2004
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];
s.submit();
}
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;
s.submit();
}
else if (category != "")
{
s.search_field.value = "category="+category;
s.submit();
}
else if (ingredients != "")
{
s.search_field.value = "ingredients="+ingredients;
s.submit();
}
}
function submit_recipe(ID)
{
document.SS.recipe_name.value = ID;
document.SS.submit();
// document.write (ID)
}
</script>
</head>
<body>
<form name="Search" method="post" action="search.asp">
<table>
<tr>
<td>Name of meal:</td>
<td><input type="text" name="meal" size="14"></td>
</tr>
<tr>
<td>Category:</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>
</select></td>
</tr>
<tr>
<td>Ingredients:</td>
<td><input type="text" name="ingredients" size="14"></td>
</tr>
<tr>
<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>
</tr>
<tr>
<td colspan="2" align="center"><a href="java_script_:SetInfo_href(4)">All</a></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<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>
</tr>
</table>
</form>
<%
search_string = Request.Form("search_field")
if IsEmpty(search_string) = TRUE then
Response.Write("")
else
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")
db.open "Cookbook"

Set rs = db.Execute (query)

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

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


 
Old March 13th, 2004, 08:57 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also, as a side not, the line that it fails on is:
db.open "Cookbook"

 
Old March 14th, 2004, 12:38 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much, I didn't know that numbers were not supposed to be encapsulated in '







Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieving an image from a mysql db kevo Beginning PHP 2 March 16th, 2007 12:59 PM
inconsistent data stealthdevil Access VBA 2 November 10th, 2006 05:03 PM
Extract part of field from inconsistent data Roly Reefer Access VBA 4 March 31st, 2005 09:25 AM
retrieving images from Access DB into asp page programmer_scs Classic ASP Databases 1 November 30th, 2004 10:19 AM
retrieving data using id. mikeuk Beginning PHP 7 July 21st, 2004 05:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.