replacing apostrophes in text box

S

shank

I replace apostrophes in usual small text strings.
How can I keep them when submitting a text box with a 500 character limit?
Am I forced to just replace them?

thanks
 
R

Ray at

Why is it any different with 500 characters? Are you running into some sort
of a problem? If so, can you describe it?

Ray at work
 
S

shank

The basis of the question was "how to keep the apostrophes from a text
box"...
thanks
 
A

Aaron Bertrand [MVP]

If you don't want the user to enter apostrophes, then use client-side script
to validate (either as they are typing, or when they hit submit).

However, I think this is a silly limitation. Consider keeping the
apostrophes in the data, since you can work around the problem that
apostrophes mess up SQL statements, without making the users pay for it by
using the back-apostrophe (`) or going without just because you didn't feel
like handling it properly.

http://www.aspfaq.com/2035
 
R

Ray at

I don't understand. How to deal with apostrophes when inserting into a
database? How to deal with them when doing a <input
value="<%=yourValue%>">? What?

Ray at work
 
V

Vilmar

YOU CAN do these on insert, update, select, delete:
varX = request("txtX")
varX = replace(varX,"'","''")

to show to user do this:
varX = objRs("FieldX")
varX = replace(varX,"''","'")
 
R

Ray at

You don't have to do any replacing like that on the way out, because the ''
isn't ever inserted (unless that was the original input value).

Ray at work
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top