INSERT: Text field with single- and double-quotes

From: RSGinCA (rsginca_at_aol.com.NO.Spam)
Date: 02/27/04


Date: 27 Feb 2004 22:49:18 GMT

I've got a program that needs to add records to a table.

One of the fields on the record is a text field, and the data that is going to
be input will sometimes have single- and/or double-quotes. This screws up the
INSERT command.

I'm not dealing with the text directly, but rather with variables which contain
the text, however when the program executes, a command like the following might
be generated:

dbs.Execute "INSERT INTO tblBusiness (BusinessID, BusinessName, Comment) VALUES
('10', 'Fred's Diner', 'Fred's mother said, "Fred's a fine cook... a fine
cook!"');"

Note: this is an oversimplified example, to illustrate the problem. My
situation actually contains a much longer text field which can frequently
contain combinations of both single and double quotes.

Those combinations of quotes doesn't work.

Is there some way to get the INSERT command to work with unpredictable
combinations of single and double quotes in the VALUES clause? Or, does
somebody have an alternative way to suggest for my program to add these
records?

Rick



Relevant Pages

  • Re: [SLE] bash Script Using Filenames with Embedded Spaces
    ... If it is a literal space for the ls command, ... wonder what effect the quotes will have placed in different places ... Antonio Vivaldi-Gloria Dixit Dominus Magnificat Choir of Kings College ...
    (SuSE)
  • Re: [SLE] bash Script Using Filenames with Embedded Spaces
    ... If it is a literal space for the ls command, ... wonder what effect the quotes will have placed in different places ... Antonio Vivaldi-Gloria Dixit Dominus Magnificat Choir of Kings College ...
    (SuSE)
  • Re: [SLE] bash Script Using Filenames with Embedded Spaces
    ... command, then it must be a literal space for any other command. ... Antonio Vivaldi-Gloria Dixit Dominus Magnificat Choir of Kings ... College Cambridge and the Academy of Ancient Music.m3u ... command is placed inside double quotes, I get the expected ls output: ...
    (SuSE)
  • Re: Bash commands: maybe they want to drive us crazy?
    ... Bill Unruh wrote: ... single quotes would cause the find command to expand the * ... Which means that a shell command and the shell itself are two very different ...
    (comp.os.linux.misc)
  • Re: Sophisticated(!) copying in DOS
    ... Try running from the command line rather than batch file till it works. ... Try using shorter path or local drive for the exclude file. ... folks, I KNOW I shouldn't put double-quotes inside double quotes, but I sure ...
    (microsoft.public.windowsxp.general)