>cConnectString="Driver=SQL Server;Server=X;Database=X;UID=X;PWD=X" >hConn=SQLStringConnect(cConnectString) >SQLExec(hConn, "select count(*) AS rcount from verylargefile","rcount") >nTotalRecordsToFetch=rcount.rcount > >lSQLResult=SQLSETPROP(hConn,"Asynchronous",.T.) >llCancel = .F. >lnResult = 0 > >ON ESCAPE llCancel = .T. >DO WHILE (!llCancel AND lnResult = 0) > lnResult = SQLExec(hConn, "select * from verylargefile","getreg") > DOEVENTS > IF USED("getreg") > nCurrentRecordsFetched=RECCOUNT("getreg") && DOESN'T WORK > ShowProgressBar(nCurrentRecordsFetched, nTotalRecordsToFetch) > ENDIF >ENDDO >IF (llCancel AND lnResult = 0) > SQLCancel(hConn) >ENDIF >SQLDisconnect(hConn) >
cConnectString="Driver=SQL Server;Server=X;Database=X;UID=X;PWD=X" hConn=SQLStringConnect(cConnectString) SQLExec(hConn, "select count(*) AS rcount from verylargefile","rcount") nTotalRecordsToFetch=rcount.rcount USE lSQLResult=SQLSETPROP(hConn,"Asynchronous",.T.) llCancel = .F. lnResult = 0 ON ESCAPE llCancel = .T. DO WHILE (!llCancel AND lnResult = 0) lnResult = SQLExec(hConn, "select * from verylargefile","getreg") DOEVENTS =USED("getreg") AND ShowProgressBar(CURSORGETPROP("RecordsFetched","getreg"), m.nTotalRecordsToFetch) ENDDO SQLCancel(hConn) SQLDisconnect(hConn)