Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error (missing operator) in query expression

Status
Not open for further replies.

cdcom81

Programmer
Jul 2, 2002
5
US
I have to do an update and the values are either from a request.querystring...or a request.form...
and I am having trouble with the syntax...
I either do not have enought quotes...then it is missing the operator...

this is the line that produced the missing operator error
objCommand.CommandText= "UPDATE MEmailAddress SET EmailAddress="& Request.Form("email")& "'WHERE EmailID=" & Request.Form("EmailID") & ";"


IDEAS???

THANKS!
 
Try this:
objCommand.CommandText= "UPDATE MEmailAddress SET EmailAddress='" & Request.Form("email") & "' WHERE EmailID=" & Request.Form("EmailID") & ";"

You were missing a single quote in front of your email address and a space between the single quote and the WHERE keyword.

The best way to see if your SQL Statements are correct is to print them to the screen before they are executed... that way you can see exactly how they are passing to the database.

 
SUPER...THANKS!!!
.that solved one problem...
now I get Too few parameters. Expected 1.
GRRR!
 
Is EmailID a number datatype or a varchar? If it is varchar, add single quotes around it.

Write it to the screen and see what it looks like:
Response.write("SQL = UPDATE MEmailAddress SET EmailAddress='" & Request.Form("email") & "' WHERE EmailID=" & Request.Form("EmailID") & ";")

If that doesn't help post the code and the screen output back here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top