If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Need Help Please!!!!!!!!!!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-29-03, 22:33
joey164 joey164 is offline
Registered User
 
Join Date: Jul 2003
Posts: 1
Angry Need Help Please!!!!!!!!!!

I'm trying to run this script to pull a product listing based on the relationship i have created

However i keep getting this error

Syntax error (missing operator) in query expression

I have no clue to what this means or how to fix it. Could someone please help. Thanks a head of time.

Function getParentProdChildDetailSQL(rs)

SQL = "SELECT tblProducts.prodID, tblProducts.prodName, tblProducts.prodImageSmallPath, tblProducts.prodDescription, tblProducts.prodLink, tblProducts.prodPrice, "_
&" tblProducts.prodSaleIsActive, tblProducts.prodSalePrice, tblParentProdDetail.ProdID, tblParentProdDetail.ProdName, "_
&" tblParentProdDetail.subParentProdProductId, tblSub_ParentProd.subParentProdProductId, tblParentProd.ParentprodID, "_
&" tblSub_ParentProd.subParentProdID, tblParentProdDetail.subParentProdProductId "_
'&" FROM tblSub_ParentProd INNER JOIN "_
&" tblProducts INNER JOIN "_
&" tblParentProdDetail ON tblProducts.prodID = tblParentProdDetail.ProdID ON "_
&" tblSub_ParentProd.subParentProdID = tblParentProdDetail.subParentProdProductId INNER JOIN "_
&" tblParentProd ON tblSub_ParentProd.subParentProdProductId = tblParentProd.ParentprodID "_'&" WHERE

Do While Not rs.EOF
SQL = SQL & " subParentProdProductId = " & rs.Fields("ParentProdID") & " OR "
rs.MoveNext
Loop

SQL = Mid(SQL, 1, len(SQL)-3)
getParentProdChildDetailSQL = SQL
Else
getParentProdChildDetailSQL = ""
End If
End Function
Reply With Quote
  #2 (permalink)  
Old 07-29-03, 22:50
Ray at Place Ray at Place is offline
Registered User
 
Join Date: Jul 2003
Location: PA
Posts: 7
I don't see any place where you're executing any SQL that would generate that error. Find the line where you're executing your SQL string (the error will tell you the line number), and instead of executing the SQL command, response.write it. Look at the SQL and see if you notice anything syntactically incorrect. If you're not sure, post it here and maybe someone will notice something.
Reply With Quote
  #3 (permalink)  
Old 07-29-03, 22:51
unatratnag unatratnag is offline
Registered User
 
Join Date: Jul 2003
Location: Ohio/Chicago
Posts: 75
take your string and paste it into the db command line directly. Replace your variables with constants and see where the error is then.

Another cause is one or more form fields was empty. You should provide default values for all form fields that are used in the query.

Last edited by unatratnag; 07-29-03 at 22:54.
Reply With Quote
  #4 (permalink)  
Old 07-29-03, 22:57
unatratnag unatratnag is offline
Registered User
 
Join Date: Jul 2003
Location: Ohio/Chicago
Posts: 75
ack, ray beat me to it. His way is also a most excellent way to see if one of your values is blank when you write it to screen.
Reply With Quote
  #5 (permalink)  
Old 08-06-03, 05:24
aliayen aliayen is offline
Registered User
 
Join Date: Aug 2003
Location: Kayseri-Turkiye
Posts: 7
Try to debug your code,

Just comment .Execute(SQL) line, and place a:

Repsonse.Write("<pre>" & SQL & "</pre>")

Line inside your code where you can easily read it.
Reply With Quote
  #6 (permalink)  
Old 08-06-03, 07:04
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
it's right there, in plain sight

you cannot say

FROM x
INNER JOIN y
INNER JOIN z
ON something
ON something

change this to

FROM x
INNER JOIN y
ON something
INNER JOIN z
ON something


rudy
http://r937.com
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On