🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to use parameters in TADOQuery

#3112
From: Vassiliev V.V.
Date: Wed, 18 Dec 2002 13:54
65 lines
3220 bytes
For me (tested in D7, BCB6) this works (Northwind database is used):

Master query:

Select * from customers

Details query:

Parameters CustomerID VarChar(50);
Select * from Orders O
where (O.CustomerID = CustomerID) and (O.ShipAddress > CustomerID)

CustomerID in details query is parameter - but it has Access syntax, not
Borland (no ":" char). To make it work you may need open Parameters property
dialog and display parameter properties. Set also TADOQuery.Prepared to
True.

Please not that this query syntax is MS Access specific and most probable
will work only with Jet databases.

----------------------------------------------------------------
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:3e004817@newsgroups.borland.com...

>
> > 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
>
> Dear sir.
> I usderstand. But my goal is not write special code for assigning of
> parameters.
> I'm talking just about case of assigning Datasorce property to TADOQuery.
> In this case when master dataset scrolls, VCL will automatically
substitute
> parameters in detail dataset IF names of some fields in master dataset are
> equal to names of parameters. AND You know about that.
> But the problem of this example is that it will not work in such mode
> because
> VCL will assign only first parameter.
>
> Can you tell, do your components solve this problem.
>
> P.S
> I use Assess
> Sincerely yours.
> Dmitry.
>
>
>
>
>
>
Technical Details
Message-ID: <3e00828c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!sn-xit-08!supernews.com!newsfeed.news2me.com!arclight.uoregon.edu!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3dfecc40@newsgroups.borland.com> <3dfee4ba@newsgroups.borland.com> <3dff15d6@newsgroups.borland.com> <3dff66dd@newsgroups.borland.com> <3e004817@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-18 06:25:48 PST
From: "Vassiliev V.V." <news@vassilievvv.mtu-net.ru>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3dfecc40@newsgroups.borland.com> <3dfee4ba@newsgroups.borland.com> <3dff15d6@newsgroups.borland.com> <3dff66dd@newsgroups.borland.com> <3e004817@newsgroups.borland.com>
Subject: Re: How to use parameters in TADOQuery
Date: Wed, 18 Dec 2002 16:54:34 +0300
Lines: 67
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: 212.188.101.45
Message-ID: <3e00828c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1040220812 212.188.101.45 (18 Dec 2002 06:13:32 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!sn-xit-08!supernews.com!newsfeed.news2me.com!arclight.uoregon.edu!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail