apostrophe replacement

C

carmen

I have a web form allowing for text answers as well as
memo answers. The answers are then inserted into an
Access database through my asp page. I'm getting an error
anytime someone types an apostrophe in the memo text
area. Is there an fix for this, such replacement code or
javascript? Thanks for any help.
 
M

MD WebsUnlimited.com

Carmen,

What is the error? May we see the code snippet at the error location?
 
M

Mike Mueller

: I have a web form allowing for text answers as well as
: memo answers. The answers are then inserted into an
: Access database through my asp page. I'm getting an error
: anytime someone types an apostrophe in the memo text
: area. Is there an fix for this, such replacement code or
: javascript? Thanks for any help.

It is an issue that I know of no fixes for. It is just one
of those special characters you should not use, along with
[]%*". We had this issue at work and a routine was written
into the program to convert the (') to a (`) before it was
written to the DB. I am sure jscript could do this, but I'm
not much of a programmer. Another option would be to use
form validation for it, but the appearance would be lost.
 
M

Mike Mueller

: I have a web form allowing for text answers as well as
: memo answers. The answers are then inserted into an
: Access database through my asp page. I'm getting an error
: anytime someone types an apostrophe in the memo text
: area. Is there an fix for this, such replacement code or
: javascript? Thanks for any help.

This site may help...
http://www.faqts.com/knowledge_base/view.phtml/aid/5807/fid/597
 
C

Carmen

Actually Mike, it was simpler than I thought. Using the
replacement trick right before the SQL statement does it,
like this:

strLastName = replace(strLastName, "'", "''")
strLikes = replace(strLikes, "'", "''")

This not only avoids the deadend with SQL, but also
preserves the apostrophe when people type comments
like "I'm going to next year's conference." into my
comment fields.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top