🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.database
Article #122

Re: Getting an SQL statemnet from a MS Access database

#122
From: Erik Bakker
Date: Tue, 02 Dec 2003 11:23
39 lines
2103 bytes
Drop an TQuery on your form
Associate it with the Database

Program in an event:
Query1.Active := false; // otherwise you can't modify
Query1.SQL.Clear;
Query1.SQL.Add ('Select * from....)
Query1.SQL.Add ('where ...');
Query1.SQL.open; // for an select, for other SQL use Query1.SQL.ExecSQL;

Now you have the results in the Query1 and you can use the cursor to read
them

for i := 0 to Query1.RecordCount -1 do
    Query1.FieldByName ('tax').asinteger := 17;
etc.

Regards, Erik.


Ralph Wesseling <Ralph@REMOVEnumberworks.com> schreef in berichtnieuws
3fba8fab$0$58714$e4fe514c@news.xs4all.nl...
> Hello,
>
> I am a bit new to database programming so I may be asking the obvious
here.
>
> I have an Access database  (myDatabase) that contains a number of queries
> (e.g. Query_Basis_For_TAX_INVOICE). I would like to get the underlying SQL
> statement form these queries and use it inside my Delphi App. Can any one
> provide me with an example to do this?
>
>
> Help would be most appreciated
>
>
> Ralph
>
>
Technical Details
Message-ID: <bqht0c$1u2$1@reader08.wxs.nl>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsgate.cistron.nl!news.cambrium.nl!news.cambrium.nl!news.cambrium.nl!newsfeed.wxs.nl!textnews.wxs.nl!not-for-mail
References: <3fba8fab$0$58714$e4fe514c@news.xs4all.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 115d96,21685b4c9bb0b998
X-Google-Attributes: gid115d96,public
X-Google-ArrivalTime: 2003-12-02 03:23:17 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsgate.cistron.nl!news.cambrium.nl!news.cambrium.nl!news.cambrium.nl!newsfeed.wxs.nl!textnews.wxs.nl!not-for-mail
From: "Erik Bakker" <Nieuws@bakkertjes.demon.nl>
Newsgroups: borland.public.delphi.database
Subject: Re: Getting an SQL statemnet from a MS Access database
Date: Tue, 2 Dec 2003 12:23:25 +0100
Organization: Planet Internet
Lines: 41
Message-ID: <bqht0c$1u2$1@reader08.wxs.nl>
References: <3fba8fab$0$58714$e4fe514c@news.xs4all.nl>
NNTP-Posting-Host: ip503ca5a5.speed.planet.nl
X-Trace: reader08.wxs.nl 1070364492 1986 80.60.165.165 (2 Dec 2003 11:28:12 GMT)
X-Complaints-To: abuse@planet.nl
NNTP-Posting-Date: 2 Dec 2003 11:28:12 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200