Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CA RecordRefresh()
Message
De
08/04/2021 15:50:34
Walter Meester
HoogkarspelPays-Bas
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01679671
Message ID:
01679692
Vues:
56
Years ago I got the following code from the VFP team (I forgot the name of the member)
			ASQLHANDLES(aSqlhndls)
			FOR EACH nOdbchdbc IN aSqlhndls
				=SQLIDLEDISCONNECT(nOdbchdbc)
			ENDFOR
Each time a connection fails, you can call a routine with these statements and it will reconnect upon the next usage of the connection.

Our product calls a SQL statement about every 5 - 15 seconds. If a connection fails, it most likely fails on that SQL statement and calling the statements above will revive the connection without any problem going forward.

It works perfectly for us. I can close my laptop at work, travel home, connect to our wifi and VPN and continue working without a problem as the database is in the UK.

Walter,








>Hi,
>
>I have a code that calls CA_OBJECT.RecordRefresh() when qvuser navigates through the records on the form.
>Most times it works. But once in a while the call fails and the error is "Communication link failure" I suspect that it happens when a user leaves the desktop for some time (lunch, coffee break, etc.) and the application loses connection to the SQL Server.
>I am thinking of a couple of ways to address this issue:
>1. I can add a parameter, say 5, to the .RecordRefresh(5). Which, I understand from the VFP help will attempt to refresh for 5 seconds. My question here, do you know, if the refresh works right away, will VFP still "stay" on 5 seconds delay?
>2. I can check the connection before each call to .RecordRefresh() using this code:
>
>	IF SQLEXEC( oApp.conn_handle, "SELECT CAST(1 as bit) As Test", "crsTestConnection")  < 0
>*-.... deal with this
>
> But I am concerned that this will slow down the navigation for all cases.
>
>TIA for any thoughts or/and input.
>
>UPDATE. I misread the 1 (above). The Parameter is the number of records, not number of seconds.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform