Solved

Code cuts off input at apostrophe(')

Posted on 2000-05-08
5
197 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 100 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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 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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now