Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Code cuts off input at apostrophe(')

Posted on 2000-05-08
5
Medium Priority
?
204 Views
Last Modified: 2008-03-06
When sending form data to my database, sometimes the input gets cut off if there's an apostrophe. E.g.: "Bob's House of Fun" makes it to the database only as "Bob". Is there an easy fix for this?
0
Comment
Question by:jstohler
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
CoolAss earned 400 total points
ID: 2790538
I usually post this stuff as a comment, but this is an easy one. :-)

Simple use the VBScript replace command to replace ever ' with a ''. This will prevent termination of the code.

As in:

MySQLString = "Bob's House of Goats"

Replace MySQLString, "'", "''"

or

MySQLString = Replace(MySQLString, "'", "''")

Both with work.
0
 
LVL 4

Expert Comment

by:CoolAss
ID: 2790549
Wow... guess I typed to fast.

The above should be:

Simply use the VBScript replace command to replace every ' (single apostrophe) with a '' (double apostrophe). This will prevent termination of the code.

As in:

MySQLString = "Bob's House of Goats"

Replace MySQLString, "'", "''"

objRS.Open MySQLString

or

MySQLString = Replace(MySQLString, "'", "''")

objRS.Open MySQLString

Both with work.


0
 

Author Comment

by:jstohler
ID: 2790560
I never used replace before, but it looks easy enough. Can I use a line like:

objRec("Sitename") = replace(Request.Form("requiredSiteName")"'","''")

or does it need to be an independent command?
0
 
LVL 4

Expert Comment

by:CoolAss
ID: 2790986
Sure... that will work fine.
0
 

Author Comment

by:jstohler
ID: 2792330
Thanks! Great response time, too.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question