Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

good ol forms 1

Status
Not open for further replies.

Ablecken

Programmer
Jun 5, 2001
130
US
say i have a form that is sent directly to a database. ive gotten everything to work but the thing is that one of the fields of the form allows anything to be put in.

if the person wnats this how do i put it in the database:

hello, 'how are you', "I'm Fine."


thanx
 
Your resulting SQL must look like this:

INSERT INTO test (test) values ('hello, ''how are you'', "I''m Fine."')

and so the input from the user must have modifications run on it using the replace() function.

Basically, you just need to replace any single tick with two single ticks. Try this:

theText = request.form("theText")
theText = replace(theText,"'","''")

sql = "INSERT INTO test (test) values ('" & theText & "')"

Should get you going.

:)
paul
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top