Board index » delphi » Executing and accessing Query

Executing and accessing Query

Hello,

I have the following question. I am writing a component that gets data
from two paradox tables. I want the component to read data from table
nr. 1 when the property GetSettings is set true. But the data from table

nr. 2 should be read when the OnTimer event is executed.
I am thinking to use a query to get the data. That brings me to the
following questions:

1) How can I execute the query every time the OnTimer event occurs.
(what is the code to do that properly)

2) When the query is executed, I want to use the result of the query
(some additional entries in the record) for other puposes. How can I
access this data. Using a normal table I would use the FieldByName
property.

3) Is this the quickest way to do this? I know this is hard to judge,
but are there maybe quicker ways or on what things do I have to pay
attention to speed up the query.

Thank you for helping me out,

Darius Blaszijk

 

Re:Executing and accessing Query


Quote
Darius Blaszijk <DBlasz...@ZonNet.nl> wrote in message

news:38A673A3.F193323D@ZonNet.nl...

Quote
> I have the following question. I am writing a component that gets data
> from two paradox tables. I want the component to read data from table
> nr. 1 when the property GetSettings is set true. But the data from table
> nr. 2 should be read when the OnTimer event is executed.
> I am thinking to use a query to get the data. That brings me to the
> following questions:

> 1) How can I execute the query every time the OnTimer event occurs.
> (what is the code to do that properly)

    Query1.Close;
    Query1.Open;

Quote
> 2) When the query is executed, I want to use the result of the query
> (some additional entries in the record) for other puposes. How can I
> access this data. Using a normal table I would use the FieldByName
> property.

Both TTable and TQuery descend from TDataSet, so accessing field values is
the same for both.

Quote

> 3) Is this the quickest way to do this? I know this is hard to judge,
> but are there maybe quicker ways or on what things do I have to pay
> attention to speed up the query.

If you are using Paradox or dBase tables, you would be better off,
speed-wise, finding a way to do what you want with TTables instead of
TQuerys.

--
Stephen Brown

Other Threads