Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Syntax error (missing operator) in query expression

Reply
Thread Tools

Syntax error (missing operator) in query expression

 
 
isaac2004
Guest
Posts: n/a
 
      02-21-2006
hello i am getting a weird al syntax error from my SQL statement

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
operator) in query expression 'tblBookDescription.strTitle Where
(((tblCategories.strCategory) = 'Database'))'.

/06Winter/levini/A07/SearchBrowse.asp, line 53


here is my server side code ps. i have already dim strSQL and objRS
prior

<% dim strBrowse

strBrowse = request.querystring("strBrowse")



'sql statement with random book ids
strSQL = "SELECT tblCategories.strCategory, tblBookDescription.ISBN,
tblBookDescription.strTitle, tblBookDescription.strDescription,
tblAuthorsBooks.AuthorID " & _
"FROM (tblBookDescription INNER JOIN tblAuthorsBooks ON
tblBookDescription.ISBN = tblAuthorsBooks.ISBN) INNER JOIN
tblCategories ON tblBookDescription.ISBN = tblCategories.ISBN " & _
"ORDER BY tblBookDescription.strTitle "



'response.write("strSQL = " & strSQL)


if strBrowse > "" then
'browse
strSQL = strSQL & " Where (((tblCategories.strCategory) = '" &
strBrowse & "')); "
end if


response.write("strSQL = " & strSQL)

Set objRS = Server.CreateObject("ADODB.Recordset")

--------------------------------------------------------------error
here
objRS.open strSQL, objConn
-----------------------------------------------------------------

%>

my response write outputs

strSQL = SELECT tblCategories.strCategory, tblBookDescription.ISBN,
tblBookDescription.strTitle, tblBookDescription.strDescription,
tblAuthorsBooks.AuthorID FROM (tblBookDescription INNER JOIN
tblAuthorsBooks ON tblBookDescription.ISBN = tblAuthorsBooks.ISBN)
INNER JOIN tblCategories ON tblBookDescription.ISBN =
tblCategories.ISBN ORDER BY tblBookDescription.strTitle Where
(((tblCategories.strCategory) = 'Database'));

thanx for the help

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      02-21-2006
isaac2004 wrote:
>
> my response write outputs
>
> strSQL = SELECT tblCategories.strCategory, tblBookDescription.ISBN,
> tblBookDescription.strTitle, tblBookDescription.strDescription,
> tblAuthorsBooks.AuthorID FROM (tblBookDescription INNER JOIN
> tblAuthorsBooks ON tblBookDescription.ISBN = tblAuthorsBooks.ISBN)
> INNER JOIN tblCategories ON tblBookDescription.ISBN =
> tblCategories.ISBN ORDER BY tblBookDescription.strTitle Where
> (((tblCategories.strCategory) = 'Database'));
>


What happens when you open your database in Access, paste this sql statement
into the SQL View of a Query Builder, and try to run it?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      02-21-2006
isaac2004 wrote:
> hello i am getting a weird al syntax error from my SQL statement
>


>
> my response write outputs
>
> strSQL = SELECT tblCategories.strCategory, tblBookDescription.ISBN,
> tblBookDescription.strTitle, tblBookDescription.strDescription,
> tblAuthorsBooks.AuthorID FROM (tblBookDescription INNER JOIN
> tblAuthorsBooks ON tblBookDescription.ISBN = tblAuthorsBooks.ISBN)
> INNER JOIN tblCategories ON tblBookDescription.ISBN =
> tblCategories.ISBN ORDER BY tblBookDescription.strTitle Where
> (((tblCategories.strCategory) = 'Database'));
>
> thanx for the help

Actually, it's not a weird error at all: it's the error one should expect to
get when trying to put the WHERE clause after the ORDER BY clause.
The clauses need to be in the correct order:
SELECT ...
FROM ...
WHERE ...
GROUP BY ...
HAVING ...
ORDER BY ...

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error (missing operator) in query expression D ASP .Net 4 07-18-2006 10:13 PM
Syntax error (missing operator) in query expression D ASP .Net 0 07-18-2006 08:06 PM
syntax error in query expression in vb.net amitbadgi@gmail.com ASP .Net 1 08-12-2005 06:26 AM
Syntax error in Query Expression, Raphael Gluck ASP General 1 10-13-2003 12:29 PM
syntax error (missing operator) query expression alexz ASP General 0 07-11-2003 05:11 PM



Advertisments