Hi all!
I’m thinking about a generic problem I have. Here the scenario…
My desktop app connects to a remote database server when I open it, and close the connection when it quits. Sometimes internet connection may be off for a little bit, so my app has to connect again to the server.
So I have an idea to avoid to quit and relaunch the app: if there is a socketerror, I have to retry the server connection. And this is done now, but (and here my troubles) the app have to execute again the query that before have generated the error.
And here the solution, but I don’t know if (and how) may be applicable: I have a “reconnectdb()” function that I “call” when I have a connection error, but the reconnectdb() (at its end) have to relaunch the method that called it…
For example: the method “searchinvoices” fails and when it “catch” the error can call reconnectdb() and when reconnectdb gains again the connection, it have to call again “searchinvoices”… and again… the method “listcustomers” fails and when it “catch” the error can call reconnectdb() and when reconnectdb gains again the connection, it have to call again “listcustomers”…
I hope I’ve explained well my idea… Anyone has suggestions?
Thanks a lot!!!