🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to use parameters in TADOQuery

#3108
From: Mark Guerrieri
Date: Wed, 18 Dec 2002 01:46
80 lines
3502 bytes
SELECT * FROM detail_table WHERE address_id =:id AND something else
is equal =:id2

ADOQuery->Parameters->ParamByName("id")->Value = SomeValue;
ADOQuery->Parameters->ParamByName("id2")->Value = SomeValue;

Mark Guerrieri
mguerrieri@cmsgrp.com

"Vassiliev V.V." <news@vassilievvv.mtu-net.ru> wrote in message
news:3dff66dd@newsgroups.borland.com...
> >But if need in query two parameters i have to create
> > fake field in master query by means AS (alias) and use the alias as
second
> > parameter(with the other name) in subordinated query.
>
> Parameter is not field and fields are not directly related with
parameters.
>
> In Access you can define parameters inside query (that is not BDE-like
> syntax ":param" that is supported by ADO Express).
> Your query will look like:
>
> Parameters Param1 Int;
> SELECT * FROM detail_table WHERE address_id =Param1 AND something_else
> =Param1
>
> ----------------------------------------------------------------
> Regards,
> Viatcheslav V. Vassiliev
> http://www.oledbdirect.com
> The fastest way to access MS SQL Server, MS Jet (MS Access)
> and Interbase (LCPI provider, http://ibp.lcpi.lipetsk.ru) databases.
>
> "Dmitry" <programmer@mail.spbnit.ru> �������/�������� � ��������
���������:
> news:3dff15d6@newsgroups.borland.com...
> >
> > > ADO Express replaces :variable with ? in SQL query, so you need to use
2
> > > different but equal parameters.
> >
> > Yes but in this case i need to write code and manually assign parameters
> > before activating
> > query.
> > What i like now is that i dont need to write code for subordinated query
> if
> > use
> > only one parameter. But if need in query two parameters i have to create
> > fake field in master query by means AS (alias) and use the alias as
second
> > parameter(with the other name) in subordinated query.
> >
> > It is not nice for me.
> > I interested if there is special methodics for that.
> > Maybe somethere there is event where it is possble to deal with
parameters
> > before dataset activating?
> > Maybe there is some ADO Express descendant components which decide this
> > problem?
> >
> > My goal is not to write specific C++ code and use visual possibilities
of
> > Builder.
> >
> > Dmitry
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
Technical Details
Message-ID: <3dffd353@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3dfecc40@newsgroups.borland.com> <3dfee4ba@newsgroups.borland.com> <3dff15d6@newsgroups.borland.com> <3dff66dd@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,d6b087b7370736cc
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-12-17 18:10:04 PST
From: "Mark Guerrieri" <markg11@comcast.net>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3dfecc40@newsgroups.borland.com> <3dfee4ba@newsgroups.borland.com> <3dff15d6@newsgroups.borland.com> <3dff66dd@newsgroups.borland.com>
Subject: Re: How to use parameters in TADOQuery
Date: Tue, 17 Dec 2002 20:46:03 -0500
Lines: 82
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 68.44.67.205
Message-ID: <3dffd353@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1040175955 68.44.67.205 (17 Dec 2002 17:45:55 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail