Link to home
Start Free TrialLog in
Avatar of sanjshah12
sanjshah12Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Replace characters from string

Hi,
I'm rying to replace some special characters from a string before submittng to a DB, in particualr the ", I know I can use the replace command but cannot get this working for " with '

      MyComments = Request.Form("comments")
      MyComments = Replace(MyComments ,"""","'")
Avatar of sirbounty
sirbounty
Flag of United States of America image

Try this:
chr(34) = "
chr(39) = '
MyComments = Request.Form("comments")
MyComments = Replace(MyComments ,chr(34),chr(39))
Avatar of sanjshah12

ASKER

Thanks for the reply, I get an error with the script

Microsoft VBScript compilation error '800a0409'
Unterminated string constant
/AddComments.asp, line 39
chr(34) = "
-----------^

ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cool thanks - apologies about the comment - it was me being daft! thanks again!
No worries - glad I could help.  Thanx for the grade! :^)