Board index » delphi » exporting the result of a SQL-query

exporting the result of a SQL-query

Hi readers,

I've written an application, which allows the user to 'compose' his
own SQL-query. He can use 2 Oracle-databases (use 1 of them,
or both), each with numerous tables to choose from.

The SQL-query is then used as the SQL-property of a TQuery-object,
and when the application executes the SQL-query, the result is shown
in a TDBGrid-object.

This works fine and the user is happy.
But now he wants to export the result dataset, preferably to an MSAccess-
table, but if that's not possible, even an ASCII-file will do.

The main problem is of course the fact that the structure of the result
dataset is unknown at design-time.
Still, there must be a simple solution for this. After all Delphi is able to
display the result dataset in the TDBGrid-object. So, instead of sending
the dataset to the TDBGrid-object, Delphi should send it to a MSAccess-
table.

Can anyone help me with this ?

Thanks in advance,

============================================================

"Live Long and Prosper" - Spock
"And let Wisdom be your Guide" - Spock's brother

Ruud Schmeitz
Universiteit Maastricht

 

Re:exporting the result of a SQL-query


Have you looked at TBatchMove. If your app uses the BDE, this should
do what you want. Drop a BatchMove object on your form or datamodule,
set its properties (mode = batCopy). When you execute it, the table is
created, or overwritten if it already exists. Magic ;-)

HTH,
Dan

On Mon, 23 Oct 2000 20:05:44 +0200, "Ruud Schmeitz"

Quote
<R.Schme...@MEMIC.UNIMAAS.NL> wrote:
>Hi readers,

>I've written an application, which allows the user to 'compose' his
>own SQL-query. He can use 2 Oracle-databases (use 1 of them,
>or both), each with numerous tables to choose from.

>The SQL-query is then used as the SQL-property of a TQuery-object,
>and when the application executes the SQL-query, the result is shown
>in a TDBGrid-object.

>This works fine and the user is happy.
>But now he wants to export the result dataset, preferably to an MSAccess-
>table, but if that's not possible, even an ASCII-file will do.

>The main problem is of course the fact that the structure of the result
>dataset is unknown at design-time.
>Still, there must be a simple solution for this. After all Delphi is able to
>display the result dataset in the TDBGrid-object. So, instead of sending
>the dataset to the TDBGrid-object, Delphi should send it to a MSAccess-
>table.

>Can anyone help me with this ?

>Thanks in advance,

>============================================================

>"Live Long and Prosper" - Spock
>"And let Wisdom be your Guide" - Spock's brother

>Ruud Schmeitz
>Universiteit Maastricht

--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control: Consulting, Software,
and the only comprehesive textbook on this subject.
visit us at www.cmdcsystems.com
[SPAM block: change at to @ in my e-mail address]

Re:exporting the result of a SQL-query


Quote
> On Mon, 23 Oct 2000 20:05:44 +0200, "Ruud Schmeitz"
> <R.Schme...@MEMIC.UNIMAAS.NL> wrote:

> >Hi readers,

> >I've written an application, which allows the user to 'compose' his
> >own SQL-query. He can use 2 Oracle-databases (use 1 of them,
> >or both), each with numerous tables to choose from.

> >The SQL-query is then used as the SQL-property of a TQuery-object,
> >and when the application executes the SQL-query, the result is shown
> >in a TDBGrid-object.

> >This works fine and the user is happy.
> >But now he wants to export the result dataset, preferably to an MSAccess-
> >table, but if that's not possible, even an ASCII-file will do.

> >The main problem is of course the fact that the structure of the result
> >dataset is unknown at design-time.
> >Still, there must be a simple solution for this. After all Delphi is able to
> >display the result dataset in the TDBGrid-object. So, instead of sending
> >the dataset to the TDBGrid-object, Delphi should send it to a MSAccess-
> >table.
"Dan Brennand" <D...@CMDCsystems.com> wrote in message

news:39f4a368.19463372@news.dimensional.com...

Quote
> Have you looked at TBatchMove. If your app uses the BDE, this should
> do what you want. Drop a BatchMove object on your form or datamodule,
> set its properties (mode = batCopy). When you execute it, the table is
> created, or overwritten if it already exists. Magic ;-)

> HTH,
> Dan

> --
> Dan Brennand
> CMDC systems, inc.
> Configuration Management and Document Control: Consulting, Software,
> and the only comprehesive textbook on this subject.
> visit us at www.cmdcsystems.com
> [SPAM block: change at to @ in my e-mail address]

Hi Dan,

TBatchMove is EXACTLY what I was looking for.

Thank you very much !!!

============================================================

"Live Long and Prosper" - Spock
"And let Wisdom be your Guide" - Spock's brother

Ruud Schmeitz
Universiteit Maastricht

Re:exporting the result of a SQL-query


You can use the SMExport (http://www.scalabium.com) which allows to
export a data into different file formats (MS Excel, MS Word, MS
Access, TXT, CSV, HTML, XML, Lotus 1-2-3, QuattroPro and more

In article <8t1ump$r1...@rl0001.unimaas.nl>,
  "Ruud Schmeitz" <R.Schme...@MEMIC.UNIMAAS.NL> wrote:

Quote
> Hi readers,

> I've written an application, which allows the user to 'compose' his
> own SQL-query. He can use 2 Oracle-databases (use 1 of them,
> or both), each with numerous tables to choose from.

> The SQL-query is then used as the SQL-property of a TQuery-object,
> and when the application executes the SQL-query, the result is shown
> in a TDBGrid-object.

> This works fine and the user is happy.
> But now he wants to export the result dataset, preferably to an
MSAccess-
> table, but if that's not possible, even an ASCII-file will do.

> The main problem is of course the fact that the structure of the
result
> dataset is unknown at design-time.
> Still, there must be a simple solution for this. After all Delphi is
able to
> display the result dataset in the TDBGrid-object. So, instead of
sending
> the dataset to the TDBGrid-object, Delphi should send it to a
MSAccess-
> table.

> Can anyone help me with this ?

> Thanks in advance,

> ============================================================

> "Live Long and Prosper" - Spock
> "And let Wisdom be your Guide" - Spock's brother

> Ruud Schmeitz
> Universiteit Maastricht

Sent via Deja.com http://www.deja.com/
Before you buy.

Other Threads