Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Connection Test
Message
De
03/07/2003 11:50:46
 
 
À
03/07/2003 11:35:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00806567
Message ID:
00806597
Vues:
14
I don't leave open connections for more than the time that I require, however, you could set an error handler to capture the "Connection Handle Invalid" error and run a simple query with SPT using your connection that returns a known record and test the return value of SQLEXEC() and the results of the error handler like:
m.lcOnError = on("error")
m.llhadSQLerror = .f.
on error m.llhadSQLerror = .t.
*!* do SQLEXEC 
if m.llhadSQLerror
*!* Error occurred with SQLEXEC()
endif
on error &lcOnError
>connection is made at start of application. But status of connection needs to be tested before each sqlexec(). App could be running for along time and lose connection. Then SQLexec() could fail. The idea is to test the connection before issuing SQLexex()
>
>Thank You Miles
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform