Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tracking how many records currently fetched (asynchronou
Message
From
08/10/2005 04:06:17
 
 
To
08/10/2005 03:48:45
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9
Database:
MS SQL Server
Miscellaneous
Thread ID:
01057402
Message ID:
01057404
Views:
8
>I need to fetch a very large amount of data from SQL Server, and want to be able to display a progress bar while the data is fetched.
>
>I'm using ASYNCHRONOUS mode with SQL PASS-THROUGH.
>
>What can I use to detect the number of records fetched at any one point? RECCOUNT() doesn't work as it attempts to finish collecting all records before it displays.
>
>The information must be available in VFP somewhere, not least because if SET STATUS BAR is ON and SET TALK is ON then the record counter counts up at the bottom of the screen.
>
>I use SQLSTRINGCONNECT to connect to the database, because I need to build the connection string dynamically - the system could connect to any number of databases.
>
>Any ideas?
>
>Mnay thanks
>Ben
>
>
>Code so far:
>
>
>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)
>
sorry, wrong answer
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform