views:

598

answers:

2

I need to refresh dbgrid constantly, in real time. Close and open dataset works fine, but blink the dbgrid. What can I do to avoid this?

I'd like a solution like Ajax, that update only the necessary.

Thanks

+8  A: 

Have you tried to use Disable- & EnableControls?

DataSet.DisableControls;
try
  DataSet.Close;
  DataSet.Open;
finally
  DataSet.EnableControls;
end;

Furthermore, it should be possible to just call DataSet.Refresh instead of closing and opening to get the same result.

Lieven
Good advice! I had forgotten that.
O Engenheiro
A: 

Ajax is only for HTML, but the underlying concept of message-oriented middleware can also be used with database content: a special central server, called message broker, receives and distributes the "database record updated" information to all connected clients. All clients 'subscribe' to a named server topic (for example with the same name as the database table), which then broadcasts all changes to the other clients, very similar to a chat application.

There are many open source message brokers which can also be used from Delphi, for example Apache ActiveMQ, Open Message Queue (OpenMQ) or JBoss HornetQ (in release 2.1), which are Java based but offer cross-language protocols.

mjustin