Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL queries asynchronously
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01179480
Message ID:
01179483
Views:
10
>>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.

Thanks!!!
Giedrius
Previous
Reply
Map
View

Click here to load this message in the networking platform