Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Syntax error (missing operator) in query expressio

Author  Topic 

malhyp
Starting Member

21 Posts

Posted - 2005-12-31 : 20:37:05
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 'TimberSpeices ='.
/html/results.asp, line 68

Line 68: Command1.Execute()

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

UPDATE tblSpecies
SET fHits = + 1
WHERE TimberSpecies = ParamSpecies

ParamSpecies Request.QueryString("TimberSpecies")

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

Table Name: tblSpecies
Column Names: idSpecies, TimberSpeices, 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 = + 1 WHERE TimberSpeices = " + Replace(Command1__ParamSpecies, "'", "''") + " "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
%>

Thanks.
Mally.

r937
Posting Yak Master

112 Posts

Posted - 2005-12-31 : 20:41:14
you'll probably want to put the value that you're comparing TimberSpeices to in single quotes

WHERE TimberSpeices = '" + Replace(Command1__ParamSpecies, "'", "''") + "' "

also, this sets fHits to 1 --

SET fHits = + 1

to increment it, you'll want to use this instead --

SET fHits = fHits + 1


rudy
http://r937.com/
Go to Top of Page

malhyp
Starting Member

21 Posts

Posted - 2005-12-31 : 20:57:29
Hey there, thanks for the reply. I didn chaneg my SQL to fead this.

WHERE TimberSpeices = '" + Replace(Command1__ParamSpecies, "'", "''") + "' "

and also changed to this.

SET fHits = fHits + 1

No longer get the error, but nor result in the Access database.

Any ideas?
Go to Top of Page

r937
Posting Yak Master

112 Posts

Posted - 2005-12-31 : 21:15:16
possibly you don't have any rows with the value passed in

rudy
http://r937.com/
Go to Top of Page

malhyp
Starting Member

21 Posts

Posted - 2005-12-31 : 21:54:07
Sorry, what do you mean by that?
Go to Top of Page

r937
Posting Yak Master

112 Posts

Posted - 2005-12-31 : 22:26:03
i mean that when this --

WHERE TimberSpeices = '" + Replace(Command1__ParamSpecies, "'", "''") + "' "

is run, there aren't any rows with TimberSpeices equal to whatever value that Command1 thing is

rudy
http://r937.com/
Go to Top of Page
   

- Advertisement -