Re: SQL syntax: How to insert srting with double quotes?
- From: Steve Jorgensen <nospam@xxxxxxxxxxxxx>
- Date: Wed, 17 Aug 2005 21:20:14 -0700
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.
.
- Follow-Ups:
- References:
- Prev by Date: Re: Alternative To Treeview Control
- Next by Date: manipulating the values from expression builder and inserting in fields
- Previous by thread: Re: SQL syntax: How to insert srting with double quotes?
- Next by thread: Re: SQL syntax: How to insert srting with double quotes?
- Index(es):
Relevant Pages
|