I'm sure this has to be a simple fix. I just cannot figure it out.

To resolve the typical apostrope issue, I have the
acarriername = Replace(txtcarriername.text, "'", "''")

My problem is that 2 apostrophes are now inserted, instead of one. For
example if someone types in IT'S NICE, when it is displayed in the input
text box later (to allow a user to change it), it says IT''S NICE.

This is a sql 2000 database.

Thanks for the help.




*** Sent via Developersdex http://www.developersdex.com ***

Re: Double apostrophes by Aaron

Aaron
Wed Jul 13 10:37:25 CDT 2005

How are you inserting the data into the database? If you are using a
command object and passing the values into a parameter, you don't need to do
the replace since it is handled for you by the provider.

Can you show all of your code so we don't have to guess and grasp at straws?




"Joey Martin" <joey@infosmiths.net> wrote in message
news:%23ofkRA8hFHA.576@tk2msftngp13.phx.gbl...
> I'm sure this has to be a simple fix. I just cannot figure it out.
>
> To resolve the typical apostrope issue, I have the
> acarriername = Replace(txtcarriername.text, "'", "''")
>
> My problem is that 2 apostrophes are now inserted, instead of one. For
> example if someone types in IT'S NICE, when it is displayed in the input
> text box later (to allow a user to change it), it says IT''S NICE.
>
> This is a sql 2000 database.
>
> Thanks for the help.
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***



Re: Double apostrophes by Bob

Bob
Wed Jul 13 10:43:47 CDT 2005

Joey Martin wrote:
> I'm sure this has to be a simple fix. I just cannot figure it out.
>
> To resolve the typical apostrope issue, I have the
> acarriername = Replace(txtcarriername.text, "'", "''")
>
> My problem is that 2 apostrophes are now inserted, instead of one. For
> example if someone types in IT'S NICE, when it is displayed in the
> input text box later (to allow a user to change it), it says IT''S
> NICE.
>
Only do the replace when writing the data into the database. Do not do it
any other time.

Better yet, stop using dynamic sql. The only reason you have to escape the
apostrophe is because you are not using parameters. See these:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&selm=eHYxOyvaDHA.4020%40tk2msftngp13.phx.gbl
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e
http://tinyurl.com/jyy0

If this does not answer your question, post a short repro script so we can
see what you're doing.

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.