updating field with text

Results 1 to 5 of 5

Thread: updating field with text

  1. #1
    Dick Boarman Guest

    Default updating field with text

    I am trying to update a field (keeping what is currently in the field and adding another text string to it), but when the string is passed through an UPDATE statement, if there is any &#039; or " in the text string, it errors because of syntax.<BR>Example:<BR>strOrigComments = rsItem("comments")<BR>strNewCommnets = Request("comments")<BR>strComment = "" & strOrigComments & strNewComments<BR>strSQL = " UPDATE Table1 SET comments = &#039;"&strcomments&"&#039; WHERE someID = &#039;"&someID&"&#039; "

  2. #2
    Join Date
    Dec 1969

    Default Fixen it

    strOrigComments = Replace(strOrigComments, "&#039;", "&#039;&#039;")<BR><BR>That will fix it for the single quotes, do that to your other variable too. Just do it before you run the SQL command and you&#039;ll be fine. Making each single quote as two single quotes is all this is doing. I don&#039;t know about double quotes, as my server handles those fine, but you could try something similar.

  3. #3
    FAQ Guest

    Default RE: updating field with text


  4. #4
    Wasabi Guest

    Default RE: updating field with text

    Update Table1 Set Comments = Comments + &#039;" & strNewComments & "&#039; where blah<BR>this is questionable, although, it wouldn&#039;t hurt to try<BR>Wasabi

  5. #5
    Wasabi Guest

    Default plus what Kris Said...


Posting Permissions

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