?
Solved

PERL Roth ODBC Escape Single Quote MSAccess

Posted on 2011-02-27
4
Medium Priority
?
616 Views
Last Modified: 2012-08-14
I have an SQL statement that the value I am inserting / updating in the DB has an embedded single quote (e.g. Let's Grow). I cannot figure out how to escape the string in PERL using Roth's ODBC utilitiles. My backend DB is MS/Access 2007

Any help would be appreciated.
0
Comment
Question by:jchauncey60
[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
  • 2
  • 2
4 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 34993434
Access expects you to include 2 single quotes:

UPDATE MyTable SET MyField="Let''s Grow"

Note that is [DQ]=[DQ]Let[SQ][SQ]s Grow[DQ]

[DQ]= "
[SQ] = '

I'm not sure how you'll do that in Perl, but that is the syntax Access expects you to use.
0
 

Author Comment

by:jchauncey60
ID: 34993810
Thanks for the quick feedback.  That doesn't get me completely there.  There is some trick with the Roth modules and Perl.
0
 

Author Comment

by:jchauncey60
ID: 34993889
You got me close to the answer and I figured the rest of it out.

MS/Access wants the values surrounded by single quotes and then you escape the embedded single quote with two single quotes

$value = Let's Grow
$value =~ s/'/''/g;

So in the SQL string it would look like 'Let''s Grow'
0
 
LVL 85
ID: 34996221
Yes - that was my suggestion to you:

"Access expects you to include 2 single quotes"

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

770 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