I have a data module with a global TADOConnection
(with the default KeepConnection
set the true).
There are numerous datasets and queries in my existing application that use this global TADOConnection
.
I was wondering if there is some smart way to resume/retry the ado connection in case of a short network disconnection? (this situation happens sometimes with clients who have a not so stable connections).
Its easy to reproduce what I need. simply open TADOConnection
on start-up. open some TADODataSet
, and then disable and enable your "Local Area Connection". if you try to refresh the dataset, an EOleException
exception is raised
"Connection failure"
or
"[DBNETLIB][ConnectionWrite (send()).]General network error. Check your network documentation"
If I restart the application all is good.
No events are fired by the TADOConnection
at the time of network disconnections. and TADOConnection.Connected
remains true
of course I could use a try/catch for every TDataSet.Open
or Execute
but I'm looking for some "centralized" solution for my large application.
so in case of "Connection failure" I could know which dataset is trying to open, and retry.
No never firing at the time of network disconnections. But you can check connection before every command. So if AdoConnection disconnected, you can reconnect and execute your command after this.
If you wanna centralized solution and you have 1 Connection, you can do that like this;
Procedures;
Any question?