Home > ASP Development > Need help: Syntax error (missing operator) in query expression.

Need help: Syntax error (missing operator) in query expression.



Need help: Syntax error (missing operator) in query expression.



Hey there, can anyone suggest why I am getting the following error.

Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'TimberSpecies ='.

/html/results.asp, line 68



Line 68: Command1.Execute()



I have created the following command in a results.asp page.



UPDATE tblSpecies

SET fHits = fHits + 1

WHERE TimberSpeices = ParamSpecies



ParamSpecies Request.QueryString("TimberSpecies")



If it helps, I have a database with the following.



Table Name: tblSpecies

Column Names: idSpecies, TimberSpecies, fHits.



Also have included the code that Dreamweaver creates for the SQL.



<%

set Command1 = Server.CreateObject("ADODB.Command")

Command1.ActiveConnection = MM_connTimber_STRING

Command1.CommandText = "UPDATE tblSpecies SET fHits = fHits + 1 WHERE TimberSpecies = " + Replace(Command1__ParamSpecies, "'", "''") + " "

Command1.CommandType = 1

Command1.CommandTimeout = 0

Command1.Prepared = true

Command1.Execute()

%>



Thanks.

Mally.

    
Guest


Probably ParamSpecies is empty even though you expect it to have some data.

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by Doug G
Probably ParamSpecies is empty even though you expect it to have some data.




Sorry re the lack of understanding, how do I tell, or how do I fix?





Mally.

Was this answer helpful ? Yes No   
Guest


Shouldn't this line:


Code:


ParamSpecies Request.QueryString("TimberSpecies")




be:

Code:



ParamSpecies = Request.QueryString("TimberSpecies")




And take place right before your sql statement.

Was this answer helpful ? Yes No   
Guest


is this your code or a typo highlighted




Code:



UPDATE tblSpecies
SET fHits = fHits + 1
WHERE TimberSpeices = ParamSpecies






Smalls.

Was this answer helpful ? Yes No   
Guest


It is a typo on this thread.



It is spelt correctly in the SQL.

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by malhyp
It is a typo on this thread.



It is spelt correctly in the SQL.




no probs, it is normally easier if you copy and paste your code in the code tags, that way it eliminates typos.



happy new year



Smalls.

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved