Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

apostrophe replacement

3 views
Skip to first unread message

middletree

unread,
Sep 9, 2004, 5:08:02 PM9/9/04
to
I know this is a very commonly asked question, but I can't find a solution
anywhere that I have looked.

I need to take the text that will be typed in paragraph form by the user
(textarea field) and do two things with it:

1. Store it in a SQL Server database field
2. Send it in an email upon page submit.

Of course, single quotes have caused problems, so I have this code:
strInternalDesc =
Replace(Trim(Request.Form("InternalDesc")),"'","''")

Problem is, it shows up like this in the email that is sent:
==============================
We''re in the process of
==============================

I would like to get rid of the double apostrophes, but not sure how. Went to
an article on ASPFAQ, and saw something which directed me to do this:

strInternalDesc =
Replace(Trim(Request.Form("InternalDesc")),"'",chr(34))

However, that just makes it a regular double-quote. I guess I could try and
find out what the character number for apostrophes are, but not sure where
that is. Besides, will that mess up my SQL Server or the email if I do that?

TIA


Aaron [SQL Server MVP]

unread,
Sep 9, 2004, 5:09:44 PM9/9/04
to
> Of course, single quotes have caused problems, so I have this code:
> strInternalDesc =
> Replace(Trim(Request.Form("InternalDesc")),"'","''")
>
> Problem is, it shows up like this in the email that is sent:
> ==============================
> We''re in the process of
> ==============================

Well, either send the e-mail before replacing and updating the database, or
else have two variables.

strInternalDescMail = Trim(Request.Form("InternalDesc"))
strInternalDescDB = Replace(strInternalDescMail,"'","''")

A


middletree

unread,
Sep 9, 2004, 5:17:38 PM9/9/04
to
Makes sense. Thanks!


"Aaron [SQL Server MVP]" <ten...@dnartreb.noraa> wrote in message
news:emUX%23FrlE...@TK2MSFTNGP14.phx.gbl...

Ray Costanzo [MVP]

unread,
Sep 9, 2004, 5:19:04 PM9/9/04
to
My thoughts on this are here:
http://groups.google.com/groups?selm=uDP29%23jfEHA.2000%40tk2msftngp13.phx.gbl&rnum=1

Ray at work


"middletree" <middl...@htomail.com> wrote in message
news:%23GX$YErlE...@tk2msftngp13.phx.gbl...

Aaron [SQL Server MVP]

unread,
Sep 9, 2004, 5:26:56 PM9/9/04
to
> Makes sense. Thanks!

Hey, don't feel bad. At least you aren't one of those people stumbling on
the idea of how to send the content in an e-mail and to the database, all in
the same page. I don't understand the confusion there, do they think that
if you send an e-mail or update the database, you can't do anything else?
The page just ends? It hasn't come up recently but it has come up often
enough that I smack my head and ask, "why this again?"


middletree

unread,
Sep 9, 2004, 10:43:30 PM9/9/04
to
I hope I don't cause any head injuries for you!

"Aaron [SQL Server MVP]" <ten...@dnartreb.noraa> wrote in message >

middletree

unread,
Sep 10, 2004, 8:51:50 AM9/10/04
to
Thanks. I like this. I have a question or two about a couple of things I saw
in the code, but I'll try and work those out.

thanks


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:OtguLKrl...@TK2MSFTNGP15.phx.gbl...

Ray Costanzo [MVP]

unread,
Sep 10, 2004, 8:56:46 AM9/10/04
to
Feel free to post back the questions if you don't. :]

Ray at work

"middletree" <middl...@htomail.com> wrote in message

news:ORnOyTzl...@TK2MSFTNGP14.phx.gbl...

0 new messages