SQL problem

Results 1 to 2 of 2

Thread: SQL problem

  1. #1
    Dug Guest

    Default SQL problem

    I am getting an error with this SQL statement:<BR>Syntax error in string in query expression &#039&#039 60014)&#039. <BR>(60014 is the Zip I typed in)<BR><BR>strSQL = "Insert into tblName values(&#039" & UCase(Request.Form ("txtPhone")) & "&#039,&#039" <BR>strSQL = strSQL & (Request.Form ("txtName")) & "&#039,&#039" <BR>strSQL = strSQL & (Request.Form ("txtAddress")) & "&#039,&#039" <BR>strSQL = strSQL & (Request.Form ("txtCity")) & "&#039,&#039" <BR>strSQL = strSQL & (Request.Form ("SelectState")) & "&#039,&#039" <BR>strSQL = strSQL & (Request.Form ("txtZip")) & ")"

  2. #2
    steve magara Guest

    Default RE: SQL problem

    You have a single quote on the left side of the zip but none on the right. Is zip a character field? If so it needs a quote on either side, if not, no quotes at all.<BR><BR>strSQL = strSQL & (Request.Form ("txtZip")) & "&#039)" &#060;-- added &#039 inside parend<BR><BR>A debugging trick for you: write the SQL statement to the screen and see if it&#039s being generated OK. You can even run it in your database and see not only if has any errors, but if it returns what you wanted. Saves a lot of time over using a website to debug your queries...<BR><BR>&#039----- debug code cut here ----<BR>Response.Write "My SQL: " & strSQL<BR>Response.End<BR>&#039Run that SQL command in your (Access?) database and see if it works.<BR>&#039----- debug code cut here ----<BR><BR>Hope it helps you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts