>For the same query by sql pass-through, when I use asynchronous mode, I got the result in 80 seconds, and synchronous mode in less than 5 seconds. How to explain that's so longer by asynchronous mode?
Is it possible you tested aysnc first, and sync second? Maybe the backend DB benefited from caching after the first run, so the second was faster. You could test this theory by running an async query after its sync equivalent.
My understanding with async queries is that you can tell the backend DB to run the query, then go and do other things while you're waiting. However, you have to periodically check if the backend has finished. I haven't used async queries in practice but the way I read the VFP docs says that SQLEXEC() calls will return 0 if the query is still executing, so you could do something like this (pseudo-code):
DO WHILE SQLEXEC( ... ) = 0
< Do some other stuff you want to do while the async query is running >
CallWinAPISleepFunction( < for some time period, e.g. 0.1 seconds > )
ENDDO
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up