Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Please help (missing operator) in query expression 'catagoryID ='.
Old 02-20-2006, 08:12 PM Please help (missing operator) in query expression 'catagoryID ='.
pez
Junior Talker

Posts: 4
Trades: 0
hi all
i am trying to read the data from the database(table cat) and display the information but for some reason it gives me an error.

this is what it say.

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'catagoryID ='.
/ch26/ShoppingCart/item.asp, line 32

thanks




,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,
<% @LANGUAGE = VBScript %>
<% Option Explicit %>
<HTML>
<HEAD>
<TITLE>Textbook Information Center: Titles</TITLE>
</HEAD>
<BODY BGCOLOR = "#000066">

<CENTER>
<H2><FONT COLOR = "#ffffff">Welcome to the NEWMANS Stationary</FONT></H2></CENTER>
<TABLE BGCOLOR = "#000077" BORDER = "0" WIDTH = "100%"
CELLPADDING = "0" CELLSPACING = "0">
<TR>
<TD BGCOLOR = "#000077" WIDTH = "15%">&nbsp;</TD>
<TD BGCOLOR = "#000077" WIDTH = "5%">&nbsp;</TD>
<TD BGCOLOR = "#000077" WIDTH = "60%">
<FONT COLOR = "yellow" SIZE = "2">Select a title from the
list below:</FONT>
<%
Dim connection, query, data
Set connection = Server.CreateObject( "ADODB.Connection" )
Call connection.Open( "catalog" )
' Create the SQL query and the record set
query = "SELECT * FROM cat WHERE catagoryID = " _
& Request( "catagoryid" )
Set data = Server.CreateObject( "ADODB.Recordset" )
Call data.Open( query, connection )
%>
<UL>
<% ' Begin a while loop that iterates through the records
' in the record set
While Not data.EOF
' Create a link that passes the productID number to
' description.asp and uses the title and the edition
' to label the link.
%> <LI>
<A HREF="description.asp?catagoryid=<% =data( "catagoryID" ) %>">
<FONT COLOR = "#ffffff" SIZE = "3">
<% =data( "name" ) %></A></FONT>
</LI>
<% Call data.MoveNext() ' Move to the next record
Wend
Call data.Close()
Call connection.Close()
%>
</UL>
</TD>
<TD BGCOLOR = "#000077" WIDTH = "5%" >&nbsp;</TD>
<TD WIDTH = "15%"></TD>
</TR>
</TABLE>
<% ' Provide a link back to the previous page %>
<P ALIGN = "center"><FONT SIZE = "3">Back to<STRONG>
<A HREF = "catalog.asp">Catalogue</FONT></A></STRONG>
</P>
<% Dim url

' Store the URL of this page
url = "item.asp?productid=" & Request( "productid" ) %>
<TABLE ALIGN = "center">
<TR>
<TD><IMG SRC = "images/cartonly.gif" ALT = "cartonly.gif">
</TD>
<% ' A form similar to the form in catalog.asp %>
<FORM ACTION = "viewcart.asp" METHOD = "POST">
<TD><INPUT TYPE = "submit" VALUE = "View Cart"></TD>
<INPUT TYPE = "hidden" NAME = "url" VALUE = "<% =url %>">
</FORM>
<TD><IMG SRC = "images/cartonly.gif" ALT = "cartonly.gif">
</TD>
</TR>
</TABLE>

</BODY>
</HTML>

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''
pez is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-21-2006, 09:21 AM Re: Please help (missing operator) in query expression 'catagoryID ='.
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
It sounds like Request( "catagoryid" ) is empty, are you sure there is something there? Try response.write to display the variable before executing the SQL
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 02-22-2006, 09:52 AM Re: Please help (missing operator) in query expression 'catagoryID ='.
pez
Junior Talker

Posts: 4
Trades: 0
query = "SELECT * FROM cat WHERE catagoryID = " _
&Request( "catagoryid" )

when i get rid of the highlighted words, i do get the content of table cat but as soon as i add the highlighted code, i get the error.
pez is offline
Reply With Quote
View Public Profile
 
Old 02-22-2006, 10:00 AM Re: Please help (missing operator) in query expression 'catagoryID ='.
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
That is becuase Request( "catagoryid" ) is empty.
Are you submitting a form or passing catagoryid on the query string?
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 02-22-2006, 10:58 AM Re: Please help (missing operator) in query expression 'catagoryID ='.
pez
Junior Talker

Posts: 4
Trades: 0
i am trying to get the data from the cat table and then hyperlink them and from there when the user clicks on the hyperlink, it takes them somewhere else or to another page.
pez is offline
Reply With Quote
View Public Profile
 
Old 02-22-2006, 10:59 AM Re: Please help (missing operator) in query expression 'catagoryID ='.
pez
Junior Talker

Posts: 4
Trades: 0
passing catagoryid on the query string
pez is offline
Reply With Quote
View Public Profile
 
Old 02-23-2006, 12:08 AM Re: Please help (missing operator) in query expression 'catagoryID ='.
Novice Talker

Posts: 14
Trades: 0
Hola. I am just wondering. Why did you break the SQL statement & continued from & Request..? Why don't you put them into 1 line to avoid confusion.

SELECT * FROM cat WHERE catagoryid = " & Request.Form("catagoryid")

About your error, I am not too sure. Why don't you Google-ed it?
__________________
Marriage is the price men pay for sex. Sex is the price women pay for marriage.
DOLL is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Please help (missing operator) in query expression 'catagoryID ='.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26463 seconds with 12 queries