Board index » delphi » Does Tquery.Refresh really work ???

Does Tquery.Refresh really work ???

Have anyone successfully used the Refresh method on a Tquery object ??

The only I got my dbGrid refreshed, was to close the query, and then
re-open it again.

--
-------------------------------------------------------------
Kai-Even Nilssen, student at University of Tromsoe
Phone: +47 776 81263           e-mail: k...@stud.cs.uit.no
Adress: Olsgaardvn. 20, N-9015 Tromsoe, Norway

 

Re:Does Tquery.Refresh really work ???


Quote
Kai-Even Nilssen (k...@stud.cs.uit.no) wrote:

: Have anyone successfully used the Refresh method on a Tquery object ??

: The only I got my dbGrid refreshed, was to close the query, and then
: re-open it again.

: --
: -------------------------------------------------------------
: Kai-Even Nilssen, student at University of Tromsoe
: Phone: +47 776 81263           e-mail: k...@stud.cs.uit.no
: Adress: Olsgaardvn. 20, N-9015 Tromsoe, Norway

I agree with you. Refresh does not seem to work with tables in my
programs, and I refresh my queries the same way you do. However, it works
with Interbase databases (and is a key method there). My conjecture is that
Refresh only has effects on SQL databases - but I don' remember anything
said about this in the manuals...

Greetings,

                                              Andy  

Re:Does Tquery.Refresh really work ???


On Thu, 15 Feb 1996 17:35:35 +0100, Kai-Even Nilssen <k...@stud.cs.uit.no>
wrote:

Quote
>Have anyone successfully used the Refresh method on a Tquery object ??

>The only I got my dbGrid refreshed, was to close the query, and then
>re-open it again.

Whether calling the Refresh method of a TQuery will work or not will vary
depending on a number of circumstances, including (but not limited to):
whether the table is a local one or an SQL table, (if the table is a local
one) whether the result set is read-only or read-write (the former
indicating the result set is actually a temporary table), and (if the table
is an SQL one) whether there is a unique index.

If the calling of the Refresh method fails for one of these reasons, the
alternative is closing and then reopening the TQuery.

If you are using an SQL table, it must be uniquely indexed. A primary key
index will typically be what provides this. Without this unique indexing,
the refresh process cannot be fulfilled and the Refresh method will fail.

With local tables there are a number of conditions under which the result
set of the query will not be directly from the table, but from a temporary
file. In these cases, the BDE does not have access to any indexes (they
would be for the actual table, not the temporary). Without the index, no
refresh.

**************************************************************************
Steve Koterski                  "Results! Why, man, I have gotten a lot of
Product Group Manager           results. I know several thousand things
Delphi Technical Support        that won't work."
Borland International, Inc.                    -- Thomas Edison, 1847-1931

Re:Does Tquery.Refresh really work ???


Quote
Kai-Even Nilssen wrote:

> Have anyone successfully used the Refresh method on a Tquery object ??

> The only I got my dbGrid refreshed, was to close the query, and then
> re-open it again.

> --
> -------------------------------------------------------------
> Kai-Even Nilssen, student at University of Tromsoe
> Phone: +47 776 81263           e-mail: k...@stud.cs.uit.no
> Adress: Olsgaardvn. 20, N-9015 Tromsoe, Norway

The refresh method only works on Queries that are uniquely indexed (???).

Re:Does Tquery.Refresh really work ???


Quote
>> Have anyone successfully used the Refresh method on a Tquery object ??

>> The only I got my dbGrid refreshed, was to close the query, and then
>> re-open it again.

>The refresh method only works on Queries that are uniquely indexed (???).

     Doesn't work on those either for me.
_
Pennsylvania: Those aren't potholes, they are speed bumps.

+------------------------------------------------------------+
|Chad Z. Hower  -  phoe...@pobox.com                         |
|Phoenix Business Enterprises - p...@pobox.com  - www.pbe.com |
|Physically in Church Hill, TN - Logically Not Sure          |
+------------------------------------------------------------+

Quote
>>SQUID - The ultimate database reader, and NO limits. #$737961

**Special Compile: 1.033B (Beta)

Other Threads