Re: Networking Problem with Delphi


[ Delphi Forum -- by DelphiLand ]

Posted by webmaster Guido on October 05, 2003 at 17:34:18:

In Reply to: Networking Problem with Delphi posted by Mark on September 28, 2003 at 12:22:47:

: Dear Forum Members,

: I'm experiencing problems with networking two workstations running Delphi, whereby I intend to share a database table between these two workstations.

: However, when I apply changes to the **.DB file on the first workstation, the changes are not reflected on the datagrid of the second workstation.

: I understand that it could be because the database table is locked but I need help from the Forum on how to resolve the unlocking of this database table for simultaneous database updates to a single table from two separate workstations networked through a router.
----------------

The datagrid on the second workstation only shows the updated data when you "refresh" the database table:

- for a TTable: use Table1.Refresh;
- sometimes "Refresh" doesn't do the job (usually it does nothing for a TQuery, when you haven't changed the SQL of the query). In that case, close the dataset and open it again:
Query1.Close;
Query1.Open;

Of course, the problem lies in not knowing when one of the other workstations changed the database table... So your app should refresh the grid, if that grid is showing info for longer than N seconds:

A. Use a TTimer for automatically refreshing every N*1000 milliseconds).

B. Or check every N seconds when the table was last modified and refresh the view if necessary, by reading the date/time of the file, or read some secondary "flag" file.



Related Articles and Replies:


[ Delphi Forum ]
[ DelphiLand: free Delphi source code, tips, tutorials ]