🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #4458

Re: Params and ADOQuery

#4458
From: Marshall
Date: Thu, 03 Jan 2002 07:48
54 lines
2709 bytes
yup i think you both gave me the right answer. should've tried that before
posting *slaps head*.

cheers

--
M
"David Barnes" <david@kalos-inc.com> wrote in message
news:3C3328DC.5030202@kalos-inc.com...
> From what I see of this code, I would remove the single quotes from your
> Select statement. Ex.
>  >   ADOQuery3->SQL->Add(":ACode AS expr1,");
>
> I believe you only need these when you have text in your SQL. Ex.
>  >   ADOQuery3->SQL->Add("where Author_Name = 'TOLKIEN' ");
>
> and then as a qualifier, not as a field name.
>
> Do you not know what field names you will be using when running your
query?
>
> Maybe what you are looking for would be more like this:
>
> ADOQuery3->SQL->Add( "INSERT INTO Author ( Author_Code, Author_Name,
> Author_Address ) " );
> ADOQuery3->SQL->Add( "SELECT NewCode, NewName, NewAddress FROM NewTable
> where NewName = :AName " );
>
> ADOQuery3->Query3->Parameters->ParamByName( "AName" )->Value = "TOLKIEN";
> etc...
>
> Hope this is more helpful then confusing.
>
> David Barnes
>
> Marshall wrote:
>
> > Just to clarify a  bit:
> >
> >   ADOQuery3->SQL->Add("INSERT INTO Author(Author_Code, Author_Name,
> > Author_Address) SELECT ");
> >   ADOQuery3->SQL->Add("' :ACode ' AS expr1,");
> >   ADOQuery3->SQL->Add("' :AName ' AS expr2,");
> >   ADOQuery3->SQL->Add("' :AAddress ' AS expr3;");
> >
> >   ADOQuery3->Parameters->ParamByName("ACode")->Value = ACode;
> >   ADOQuery3->Parameters->ParamByName("AName")->Value = AName;
> >   ADOQuery3->Parameters->ParamByName("AAddress")->Value = AAddr;
> >
> > is the code im using and the error i get is:
> >
> > <Project Name.exe> raised exception class EDatabaseError with message
> > 'Parameter 'ACode' not found'.
>
Technical Details
Message-ID: <3c340cc1_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3c32b114_2@dnews> <3c32b92d_2@dnews> <3C3328DC.5030202@kalos-inc.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,4aff3e15a2c4b841
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-01-02 23:57:00 PST
From: "Marshall" <adworx@ihug.co.nz.spammenot>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3c32b114_2@dnews> <3c32b92d_2@dnews> <3C3328DC.5030202@kalos-inc.com>
Subject: Re: Params and ADOQuery
Date: Thu, 3 Jan 2002 20:48:09 +1300
Lines: 56
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 203.173.230.153
Message-ID: <3c340cc1_2@dnews>
X-Trace: dnews 1010044097 203.173.230.153 (2 Jan 2002 23:48:17 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews