Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 13th, 2004, 08:15 PM
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];
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>


Reply With Quote
  #2 (permalink)  
Old March 13th, 2004, 08:57 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Ottawa, , Canada.
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"

Reply With Quote
  #3 (permalink)  
Old March 14th, 2004, 12:38 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Ottawa, , Canada.
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 '


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:07 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.