[thelist] Syntax error

Warden, Matt mwarden at mattwarden.com
Sat Oct 27 06:19:40 CDT 2001


On Oct 27, Eric Stanton had something to say about [thelist] Syntax error

>Hello List,
>
>I am working on a dynamic shopping cart for a customer.  Using ASP, Java,
>Javascript.  We use a search page "search.asp" that throws variables to
>"Search_Results.asp"  and displays records from an access DB. Search_
>Results.asp displays the first 10 records as it should. But open click the
>link to retrieve the next 10 records I get the following error:
>
>"Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
>
>[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in
>query expression 'Depth = And subcatCategoryId = AND LEFT(CatHierarchy,3) =
>'vID''.
>
>/SFLib/incSearchResult.asp, line 169 "

replace:

"Depth = And subcatCategoryId = AND LEFT(CatHierarchy,3) = 'vID'"

with:

"Depth = SOMETHING And subcatCategoryId = AND
" & LEFT(CatHierarchy,3) & " ='vID'"

and if that last vID is a variable:

"Depth = SOMETHING And subcatCategoryId = AND
" & LEFT(CatHierarchy,3) & " ='" & vID & "'"


basically, your problems where:

1. Depth =
	- no comparison value.... just Depth =
2. LEFT(...)
	- this is a vbscript function, not a sql function, so it muct
occur "outsite" or before your sql string and then its result is
included in the sql string. see above for how to do this. basically, treat
it like it's a variable.
3. vID (maybe)
	- if this is a variable, again, this is a vbscript variable so
only its result can be included in the sql string. otherwise, the sql
server will think it's a literal string and treat it as such.


hope this helps. if you have the actual line of code that includes the sql
above, maybe i can help you further.


thanks,



--
mattwarden
mattwarden.com





More information about the thelist mailing list