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 14th, 2004, 12:13 AM
Friend of Wrox
 
Join Date: Mar 2004
Location: Ottawa, , Canada.
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default error while trying to display db info

I have these 2 pages (search/display), search sends over the ID of the item which was selected, allowing me to display the selected items. I'm getting this error now, even if I hard code the data "select * from Recipe where ID = '1'", it still gives me to same error message... Any ideas as to what I'm doing wrong???

Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/cookbook/display.asp, line 16


line 16 -> Set rs = db.Execute ("SELECT * FROM Recipe WHERE ID = '"&recipe_ID&"'")

<body>
<%
 recipe_ID = Request.Form("recipe_name")
 if (IsEmpty(recipe_ID)) = TRUE then
  response.Write("")
 else
  Set db = Server.CreateObject("ADODB.Connection")
  db.Open = "Cookbook"

  Set rs = db.Execute ("SELECT * FROM Recipe WHERE ID = '"&recipe_ID&"'")
   meal = rs("R_name")
   category = rs("R_category")
   instructions = rs("R_instructions")
   ingredients = rs("R_ingredients")
   picture = rs("R_picture")
 end if
%>
<h1><%=meal%></h1>

<table width=100%>
 <tr><td><b>Ingredients</b><br>
 [list]
  <%
   dim arringredients
   arringredients = Split(ingredients, ",")
   for i=0 to UBound(arringredients)
    Response.Write "<li>"&arringredients(i)&"</li>"
   next
  %>
 </ul></td>
 <td>
  <img src="<%=picture%>" alt="<%=meal%>" border="0" width="200" height="200">
 </td>
 </tr>
</table>

<b>Instructions</b><br>
<%
 Dim arrinstruct
 arrinstruct = Split (instructions,":")
 for j=0 to UBound(arrinstruct)
  k = j+1
  Response.Write("<b>Step "&k&" </b>"&arrinstruct(j)&"<br>")
 next
%>



Reply With Quote
  #2 (permalink)  
Old March 14th, 2004, 06:59 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

If the ID in the table Recipe is a Number, you shouldn't enclose it's value in quotes:

Set rs = db.Execute ("SELECT * FROM Recipe WHERE ID = " & recipe_ID)

You should use quotes only for data types like text and dates.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
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
Display img from db: error on Windows Server author05 Classic ASP Databases 0 February 21st, 2008 09:45 AM
ServerFileReportService Db Info at Runtime jason_l_riley BOOK: Professional Crystal Reports for VS.NET 0 January 15th, 2006 09:29 PM
display an image (more info) gorney .NET Web Services 0 December 29th, 2003 02:32 PM
How Can I Add Info From a Txt File Into a DB? Lucy Classic ASP Professional 3 October 21st, 2003 11:00 AM
info from pg won't post to db scottiegirl PHP Databases 3 September 26th, 2003 12:48 PM



All times are GMT -4. The time now is 05:25 PM.


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