Board index » delphi » Update TQuery after changes in TTable

Update TQuery after changes in TTable

I have a TQuery "connected" to a DbGrid  and a TTable "connected" to a
couple of Dbedits, They are both connected to the same database. When I make
changes in my Dbedits l also want that the Dbgrid to change values. I have
tried Query.refresh but it doesn't work , how can I update my query after
changes i my table ?
kind regards Peter E

 

Re:Update TQuery after changes in TTable


Hi Peter,

Just do ...

Query.Close;
Query.Open;

This will reset the position to the start of the query - you may want to
add code to save the position before closing and restore it after
re-opening.

Cheers,
Carl

Quote
Peter Erixon wrote:

> I have a TQuery "connected" to a DbGrid  and a TTable "connected" to a
> couple of Dbedits, They are both connected to the same database. When I make
> changes in my Dbedits l also want that the Dbgrid to change values. I have
> tried Query.refresh but it doesn't work , how can I update my query after
> changes i my table ?
> kind regards Peter E

Re:Update TQuery after changes in TTable


By the way, does anyone know *why* there is the TQuery.Refresh? Does this
have some meaning when operating with bigger C/S databases or something?

With BDE/Paradox I have not found a place where refreshing a Query would have
any effect.

Markku Nevalainen

Quote
Carl Caulkett wrote:

> Hi Peter,

> Just do ...

> Query.Close;
> Query.Open;

> This will reset the position to the start of the query - you may want to
> add code to save the position before closing and restore it after
> re-opening.

Other Threads