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

syntax error for query String

Status
Not open for further replies.

rry2k

Programmer
Jun 28, 2001
678
US
I'm getting hung up on syntax for a statement and I need help. It's an error saying Missing end of statement. I'm sure it's something simple like a quote but I'm a newbie and not getting the answer real quick. This code is a one field test to update a database.

<!-- #include file = &quot;conn.inc&quot; -->
<%
sqlstr1 =&quot;INSERT INTO Userinfo(SSN) VALUES Request(&quot;fssn&quot;)&quot;
set rs=cn.Execute(sqlstr1)%>

Thanks for the help..Russ
 
Try escaping the embedded quotes in your string, or using apostrophes instead:
Code:
<%
sqlstr1 =&quot;INSERT INTO Userinfo(SSN) VALUES Request(\&quot;fssn\&quot;)&quot;
set rs=cn.Execute(sqlstr1)%>

OR

<%
sqlstr1 =&quot;INSERT INTO Userinfo(SSN) VALUES Request('fssn')&quot;
set rs=cn.Execute(sqlstr1)%>

Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
You need to this:

<%
sqlstr1 =&quot;INSERT INTO Userinfo(SSN) VALUES (&quot; & Request(&quot;fssn&quot;) & &quot;)&quot;
set rs=cn.Execute(sqlstr1)%>

unless your SSN column is a string data class and then you need:

<%
sqlstr1 =&quot;INSERT INTO Userinfo(SSN) VALUES ('&quot; & Request(&quot;fssn&quot;) & &quot;')&quot;
set rs=cn.Execute(sqlstr1)%>

Hope that works! &quot;A computer scientist is a person who knows when it is time to hit the computer.&quot;

John

johnmc@mvmills.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top