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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax error

Status
Not open for further replies.

TempAcct

Technical User
Joined
Jan 11, 2004
Messages
1
Location
US
I have created an asp page that takes down customer info. What I am trying to do is read from my database and compare a field to an html variable. Here is the code that I am using

sqlstring = "SELECT * from (table) WHERE (field)=" &(variable)

I recieve the following error:

"You have an error in your SQL syntax"
and it says that it is near the closing parenthesis.
is there a way around this? Or is my syntax just wrong. Any help would be great!
 
As your HTML variable is a string you need to enclose it with single quotes:

sqlstring = "SELECT * from (table) WHERE (field)='" &(variable) & "'"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top