Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

access query to allow apostrophes
Welcome, Guest. Please login or register.
December 03, 2008, 03:28:22 PM
11305 Posts in 1249 Topics by 498 Members
Latest Member: katCheeme
Experts Round Table Network  |  Databases  |  Access  |  access query to allow apostrophes « previous next »
Pages: 1 [2] 3 4
Author Topic: access query to allow apostrophes  (Read 5318 times)
Johnny26652

Offline Offline

Posts: 61


« Reply #15 on: April 20, 2007, 04:24:33 PM »

interesting quote :-)
Logged

Johnny
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #16 on: April 20, 2007, 04:31:06 PM »

It wasn't directed at you, it's just my favorite.  If you look around herre you'll find the French version from VGR.  I don't remember which post it is in though.
Logged

Rod
Johnny26652

Offline Offline

Posts: 61


« Reply #17 on: April 20, 2007, 04:34:51 PM »

I know its not me because i open my mouth and remove all doubt :-) I can only imagine what Mr.VGR has written.. i mean the french :-)
Logged

Johnny
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #18 on: April 20, 2007, 04:36:45 PM »

"Mieux vaut ne rien dire et passer pour un con que de l'ouvrir et ne laisser aucun doute a ce sujet"

Google translates as: “Better is worth nothing to say and pass for an idiot but to open it and not leave any doubt on this subject” which of course can't be 100% correct as it probably should translate to “Better to say nothing and pass for an idiot then to open the mouth and leave no doubt on this subject”
Logged

Rod
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #19 on: April 21, 2007, 03:26:13 AM »

je vois qu'on s'amuse bien dans mon dos ;-)

"quand le chat n'est pas là, les souris dansent" :D
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
nico5038

Offline Offline

Posts: 11


« Reply #20 on: April 30, 2007, 06:32:46 AM »

Storing a variable that might contain a single quote in a SQL string is normally done by using CHR(34) like:

INSERT INTO tblX (NameField) VALUES (" & chr(34) & me!NameField & chr(34) & ");)

The chr(34) stands for a double quote and will neutralize the "query string breaking effect" that the single quote causes.

Nic;o)
Logged
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #21 on: May 01, 2007, 03:18:32 AM »

will this work if the page's charset is not ASCII ? ;-)))
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
nico5038

Offline Offline

Posts: 11


« Reply #22 on: May 01, 2007, 03:44:56 AM »

Not sure what the page characterset means.
In SQL syntax the use of double quotes will neutralize single quotes like:

INSERT INTO tblX (MyName) VALUES ("O'Brian")

somewhere the SQL needs to be passed to the JetEngine, so how can a page interfere?

Nic;o)
Logged
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #23 on: May 01, 2007, 02:50:39 PM »

will this work if the page's charset is not ASCII ? ;-)))

Unless you are using EBCDIC or a non-Latin character set.
Logged

Rod
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #24 on: May 01, 2007, 03:37:22 PM »

Nico, in SQL double quotes do not exist. The string delimitor is the single quote. Contents should be escaped. Using char(x) is unreliable, especially for codes over 127 and reminds me of the days I programmed in BASIC back 25 years ago ;-)
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
nico5038

Offline Offline

Posts: 11


« Reply #25 on: May 01, 2007, 03:46:38 PM »

Hi VGR, in the Access helpfile I find:
--------------------------------------------------------------------------------------------
Include a Variable Representing Quotation Marks

You can create a string variable that represents double quotation marks, and concatenate this variable into the criteria argument along with the value of the variable. The ANSI representation for double quotation marks is Chr$(34); you could assign this value to a string variable called strQuote. You could then construct the criteria argument as in the following example:

"[LastName] = " & strQuote & strName & strQuote
--------------------------------------------------------------------------------------------

And in that way I've used it many times. As this Q has been posted in the Access area, I thought the Access rules are applicable, although I know there are different dialects :-)

Nic;o)
Logged
Johnny26652

Offline Offline

Posts: 61


« Reply #26 on: May 01, 2007, 04:50:08 PM »

Sorry Nico my bad. Actually it is Access/ASP.
Logged

Johnny
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #27 on: May 01, 2007, 06:17:45 PM »

Access SQL does vary from the SQL standard and uses double quotes.
Logged

Rod
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #28 on: May 02, 2007, 09:45:16 AM »

expanding on Rod's comment and better explaining what I meant (all of us are right)

Quote
Storing a variable that might contain a single quote in a SQL string is normally done by using CHR(34)

What I was complaining about is the use of "SQL" in this sentence. Should read : "Access"
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #29 on: May 02, 2007, 11:19:23 AM »

expanding on Rod's comment and better explaining what I meant (all of us are right)

What I was complaining about is the use of "SQL" in this sentence. Should read : "Access"

This is the Access Forum
Logged

Rod
Pages: 1 [2] 3 4
« previous next »
    Jump to: