Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL queries asynchronously
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01179480
Message ID:
01179482
Vues:
14
This message has been marked as the solution to the initial question of the thread.
>Hello,
>
>I have complex query which runs more than 30 seconds on SQL server.
>When I'm processing this query from VFP, program stops responding until results were returned.
>I saw that it's possible to use SQLEXEC asynchronously, but didn't find good article how to use it.
>Can anybody send me a link to resource where it is possible to read about using SQLEXEC asynchronously with examples.
>
>Thanks in advance.

On top of my head
*** Set the query to be ran asynchronously
SQLSETPROP(sqlHandler, [Asynchronous], .t.)
IF SQLEXEC(sqlHandler,....,[crsCursorThatReceiveResultSet]) < 0 && Your long query
   AERROR(laError)
   MessageBox([Query can not be ran ]+laError[1,2])
   SQLSETPROP(sqlHandler, [Asynchronous], .f.)
   RETURN
ENDIF

....
&& There where you first time need the result of that query:
IF NOT USED([crsCursorThatReceiveResultSet]) && Query still runs
   *** Do something
   RETURN
ENDIF
SELECT crsCursorThatReceiveResultSet
GO BOTTOM && Force whole resultset to be received.
....
Don't forget to reset back [Asynchronous] for this sqlHandler.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform