CLEAR #define _StatementBusy_ "ConnectBusy" SQLSETPROP(0,"BatchMode",.T.) SQLSETPROP(0,"Asynchronous",.F.) s1=SQLCONNECT('temp_mariano',.T.) s2=SQLCONNECT(m.s1) TEXT TO sqlCmd NOSHOW CREATE TABLE #TABLE1 (F1 INT IDENTITY,F2 TEXT) INSERT #TABLE1 (F2) VALUES (REPLICATE('ciao',1000)) DECLARE @n INT SELECT @n=1 WHILE @n<8 BEGIN SELECT @n=@n+1 INSERT #TABLE1 (F2) SELECT F2 FROM #TABLE1 END SELECT * INTO #TABLE2 FROM #TABLE1 SELECT @@ROWCOUNT n ENDTEXT IF SQLEXEC(m.s1,m.sqlCmd,'NUMBER')=1 ? 'Expected ',NUMBER.n * end build context ? SQLSETPROP(m.s1,"Asynchronous",.T.); , SQLSETPROP(m.s2,"Asynchronous",.T.) =CURSORSETPROP("AllowSimultaneousFetch",.T.,0) =CURSORSETPROP("FetchAsNeeded",.F.,0) =CURSORSETPROP("FetchSize",10,0) waitfree(m.s1) ? 'Start 1',SQLEXEC(m.s1,"SELECT * FROM #TABLE1","cursor1") ? 'stmt 1 busy :',SQLGETPROP(m.s1,_StatementBusy_) ? 'stmt 2 busy :',SQLGETPROP(m.s2,_StatementBusy_) *-------------------------------------------- * try to uncomment the next line ! * showcursor (m.s1,'cursor1') waitfree(m.s2) * when exect this line , the cpu go to 100% ? 'Start 2',SQLEXEC(m.s2,"SELECT * FROM #TABLE2","cursor2"),MESSAGE() *--------------------------------------------- ? 'stmt 1 busy :',SQLGETPROP(m.s1,_StatementBusy_) ? 'stmt 2 busy :',SQLGETPROP(m.s2,_StatementBusy_) showcursor (m.s2,'cursor2') *showcursor (m.s1,'cursor1') DO WHILE INKEY(0.1)#6 DOEVENTS FORCE ENDDO ENDIF ? SQLCANCEL(m.s2),SQLCANCEL(m.s1) ? SQLDISCONNECT(m.s2),SQLDISCONNECT(m.s1) PROCEDURE showcursor (s,c) tout=DATETIME()+20 DO WHILE m.tout>DATETIME() AND !USED(m.c) =SQLEXEC(m.s) DOEVENTS FORCE ENDDO IF USED(m.c) SELECT (m.c) BROWSE NOWAIT ENDIF PROCEDURE waitfree(s) DO WHILE SQLGETPROP(m.s,_StatementBusy_) DOEVENTS FORCE ENDDO