Re: SQL syntax: How to insert srting with double quotes?



On Thu, 18 Aug 2005 03:49:03 GMT, "deko" <deko@xxxxxxxxxx> wrote:

>> Ah - I see the problem. Once you've built the SQL string, it's too late
>> to
>> use a quote fix function because you've already lost any information about
>> what quotes are delimiters, and what quotes are content. You need to fix
>> up
>> each argument before you put it into the SQL string.
>
>So, when I have 3 substrings that I concatenate to create a new string, I
>need to first fix each of the 3 substrings before concatenation? And
>"fixing" the substring involves doubling *only* the outer quotes -
>regardless if they are single or double? Is this correct?

I think you've got it, but just to be precise - you double only the quotes in
the expression that are of the same type as the quotes that surround the
expression.

>> Of course, I still recommend using parameters instead.
>
>I will explore this. But even with parameters, I will still need to fix the
>substrings, correct?

No - that is not correct. The point of the database APIs is to abstract away
how things are done at a lower level. How strings are encoded to pass them to
an SQL parser is one of those low-level issues that query parameters are
designed to abstract away and handle for you.

>> First, I don't know why you don't want to use DAO objects, but given that
>> you
>> don't, just do something like the following (noting that I'm following
>> your
>> variable naming, though it's not what I'd recommend):
>
>That function is part of an error handler, so I want to keep it as simple as
>possible. But I suppose I could stick with Hungarian naming convention.

I'm not saying one should always go with hungarian notation, in fact, I've
decided to never use it for parameter names anymore. I would say, though,
that in VB code, if you don't use hungarian, you should capitalize the first
letters of names so it's clear that any abbreviations are -not- Hungarian
prefixes. I also wouldn't abbreviate the terms in the names as much as you
are doing. After all, it's more clear with full words than abbreviations,
since clarity is our goal.
.



Relevant Pages

  • Re: SQL syntax: How to insert srting with double quotes?
    ... > use a quote fix function because you've already lost any information about ... > what quotes are delimiters, ... You need to fix ... > each argument before you put it into the SQL string. ...
    (comp.databases.ms-access)
  • Re: Filter from Drop-Box
    ... Try putting the reference to the Quicklist control outside of the quotes ... that delimit the rest of the SQL string. ... Using a line continuation to split the line you would have: ...
    (microsoft.public.access.formscoding)
  • RE: SQL syntax in VBA for Access
    ... Turns out that the quotes around my dashes are what ... > is with the quotes in the SQL string. ... I'm trying to use vba to ... >> not getting the proper format. ...
    (microsoft.public.excel.programming)
  • Re: Need help on modifying and assembly of a small program!
    ... how do I add the quotes when I'd like to follow a link? ... > Look at the RFC, and see if the suckers on the far end are ... the easiest solution is probably to "fix" ... shouldn't waste time doing a tedious "by hand" fix of these ...
    (alt.lang.asm)
  • Re: stinger wont run - *.exe files disabled
    ... Still doesn't fix the root problem. ... exactly like that, including the quotes. ... This should stop the worm ...
    (microsoft.public.security.virus)