apostrophe - yes again

Results 1 to 4 of 4

Thread: apostrophe - yes again

  1. #1
    Join Date
    Dec 1969

    Default apostrophe - yes again

    Yes, I know that sql strings can&#039t handle apostrophes so we must use code like: <BR>strName = Replace(Request.form("name"),"&#039", "&#039&#039")<BR>to get rid of the appostorphe. But then the data gets entered into the database with &#039&#039. I just want it to have one &#039. <BR><BR>What&#039s a girl to do?<BR><BR>MaryAnn

  2. #2
    Join Date
    Dec 1969

    Default RE: apostrophe - yes again

    I am not for sure how to make the data correct in the db, unless you set up some kind of trigger that basically Replaces &#039&#039 w/ &#039.<BR><BR>What I would do is as you were displaying it in the browser, Perform a reverse Replace. Replace(rst("fieldname", "&#039&#039", "&#039")) This will make it at least look good on screen.<BR><BR>HTH<BR><BR>Jerry

  3. #3
    Steve Rowson Guest

    Default RE: apostrophe - yes again

    A minor irritating side effect of this is that any deliberate double quotes in the field are also changed to singles. Instead of changing single quotes to double I changed them to tildes - something a user is pretty unlikely to enter, and then change the tildes back to single quotes when displaying in a browser.

  4. #4
    Ali Guest

    Default RE: apostrophe - yes again

    Try using instead this:<BR>Public Function StrCnvrt(StrI)<BR><BR>For i = 1 to Len(StrI)<BR> If Mid(StrI,i,1) = "&#039" Then<BR> StrOut = StrOut & "&#039&#039"<BR> Else<BR> StrOut = StrOut & mid(StrI,i,1)<BR> End If<BR>Next<BR>StrCnvrt = StrOut<BR><BR>End Function<BR>

Posting Permissions

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