Is it possible to have an ADO Dataset that ‘knows’ if or when the underlying table has been updated?
At the moment I have to check an item status each time I receive a file for that item in a folder. This results in a lot of sql queries as we get up to 1300 events at a time.
I’m thinking to add a ADO Dataset to the application which holds the status and use Locate to check the status.
Instead of having a regular refresh with say a timer, I’d like the dataset to be updated as soon as the underlying table records are changed.
Thanks.
ADO Dataset retrieve data to client based on Client / Server concept. Like a web browser.
That means: Client Request -> Server, Server Answer -> Client. So Client really can’t know if any data has been changed.
Simplest way is to requery data (Close/Open) and fetch data by your needs, not all 1300 at once. This is most used solution.
Anyway, if amount of data is really BIG and you want to play with optimization You have two ways:
A. Build a log table and register table data changes using triggers. Periodically ask server for changes (you may do this in a background thread):
You will get RECORD_ID and OPERATION_ID (ie insert/update/delete).
B. If you are not linked to DBMS, Firebird/Interbase have events concept. Using triggers you can inform client that data has been changed, and you can requery just modified data.