Hello all,
I have a query which takes some time to complete. During the execution of the query the screen freezes and I want to prevent this by using asynchronous execution of the query.
I've searched the forum and I've produced some code following the example from Mike Lewis (link:
Here's the code:
I've added DOEVENTS but this also does not help; the UI keeps on freezing up during query execution. I'm using PostgreSQL as a back-end, could the problem lie in my ODBC driver or am I doing something wrong here?
Thanks in advance,
Dirk
I have a query which takes some time to complete. During the execution of the query the screen freezes and I want to prevent this by using asynchronous execution of the query.
I've searched the forum and I've produced some code following the example from Mike Lewis (link:
Here's the code:
Code:
LOCAL lnConn,lcQuery,lnRes
*** Setting up the connection.
lnConn = SQLCONNECT("dsn_name","login","pass")
SQLSETPROP(lnConn,"Asynchronous",.t.)
*** The query which will take some time to complete.
lcQuery = "select * from big_table"
*** Execute this query asynchronously so the user interface won't freeze up.
DO WHILE .t.
lnRes = SQLEXEC(pnHandle,lcQuery,"tresult")
DO CASE
CASE lnRes = 0
Thisform.lblMessage.Caption = "Busy..."
CASE lnRes > 0
Thisform.lblMessage.Caption = "Ready!"
EXIT
CASE lnRes < 0
Thisform.lblMessage.Caption = "An error has occured!"
EXIT
ENDCASE
DOEVENTS
ENDDO
I've added DOEVENTS but this also does not help; the UI keeps on freezing up during query execution. I'm using PostgreSQL as a back-end, could the problem lie in my ODBC driver or am I doing something wrong here?
Thanks in advance,
Dirk