Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Code cuts off input at apostrophe(')

Posted on 2000-05-08
5
Medium Priority
?
205 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
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
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…
Suggested Courses

885 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