Apostorphe prob with ASP

Rezner
04-15-2002, 08:59 PM
I have an ASP form that inserts a value from a textbox into a database. That part works fine IF there is no apostorphe in the string from the textbox.

for instance, if I write " What's up? " and then submit it, I will get an error.

How do you avoid the error and keep the apostorphe?

Robby
04-15-2002, 09:33 PM
Actually, it's the apostorphe (single quote) that you should use, not the double quotes

' yes

" no

Rezner
04-15-2002, 09:36 PM
Well, the single quote in the phrase: What's up
is what causes the problem

Robby
04-15-2002, 09:44 PM
Sorry Rezner, I missed the boat on that one, when you said apostorphe, I thought you were talking about the surrounding quotes " " , I didn't even notice that there was a single quote in what's.

You can do this..

strText = Replace(strText,"'","''")

Replace one single with two singles.

Rezner
04-15-2002, 09:59 PM
That worked just dandy -- thanks

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum