Article View: borland.public.interbase.sql
Article #297Re: double quotes in value clauses
From: Wayne Niddery (TeamB)
Date: Tue, 26 Feb 2008 16:03
Date: Tue, 26 Feb 2008 16:03
39 lines
3076 bytes
3076 bytes
"chrisgi" <chrisgi@omex.com> wrote in message
news:47c43028$1@newsgroups.borland.com...
>
> can you explain what that is
If you are executing the query yourself then a parameterized query is
something offered by SQL database servers to provide more efficiency - you
only need to give it an SQL query once, and then you can execute it any
number of times with different parameters just by passing the parameters
instead of the entire query.
However, if you need to pass a complete script to another process then this
won't work for you very well.
> s.add (' VALUES ("' + account_number.Text + '","'
> + controlcontrol_dsm.Text + '","'
> + sqldate + '","O","'
> + account_name.Text + '","'
> + acc_address1.text + '","'
> + acc_address2.text + '","'
> + acc_address3.text + '","'
> + acc_address4.text + '","'
> + acc_postcode.Text + '","'
> + acc_sec_mobile.text + '","'
You are using double-quotes to delimit the values, but the SQL standard is
to use single quotes. Double quotes are supposed to be used to indicate
metadata such as table for field names. However, just changing that won't
solve the problem of any of your values having embedded quotes. The solution
to both is to use the QuotedStr function.
s.add (' VALUES (' + QuotedStr(account_number.Text) + ','
+ QuotedStr(controlcontrol_dsm.Text) + ','
+ // etc...
--
Wayne Niddery - TeamB (www.teamb.com)
Winwright, Inc. (www.winwright.ca)
Technical Details
Message-ID:
<47c4387c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<47c424be$1@newsgroups.borland.com> <47c42b1c$1@newsgroups.borland.com> <47c43028$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,5ae3542750123753 X-Google-Attributes: gid114a0e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Wayne Niddery \(TeamB\)" <wniddery@chaffaci.on.ca> Newsgroups: borland.public.interbase.sql References: <47c424be$1@newsgroups.borland.com> <47c42b1c$1@newsgroups.borland.com> <47c43028$1@newsgroups.borland.com> In-Reply-To: <47c43028$1@newsgroups.borland.com> Subject: Re: double quotes in value clauses Date: Tue, 26 Feb 2008 11:03:56 -0500 Lines: 40 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6000.16480 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16545 NNTP-Posting-Host: 24.137.214.213 Message-ID: <47c4387c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1204041852 24.137.214.213 (26 Feb 2008 08:04:12 -0700) X-Authenticated-User: wniddery Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail