Article ID: 114355
Article Last Modified on 12/1/2003
SET LIBRARY TO SYS(2004)+"fpsql.fll"
PUBLIC handle
dsource="foxtest"
errval=0
errmsg=""
* foxtest is a single-tier FoxPro database driver.
handle=DBConnect(dsource,"","")
=DBSetOpt(handle,"Asynchronous",1)
sql="select * from customer"
waittime=2
start=SECONDS()
retcode=DBExec(handle,sql)
* This DO WHILE code below is never executed because retcode=1....
* i.e., the DBExec() above returns all the results synchronously.
DO WHILE ((retcode=0) AND (SECONDS() - start < waittime))
retcode=DBExec(handle,sql)
ENDDO
IF (retcode= 0)
retcode=DBCancel(handle)
ENDIF
IF (retcode != 1)
error=DBError(handle,@errmsg,@errval)
CLEAR
@ 2,2 SAY errval
@ 3,2 SAY errmsg
ENDIF
PUBLIC handle
dsource="foxtest"
errval=0
errmsg=""
**** foxtest is a datasource name for a single-tier FoxPro database driver.
handle=SQLConnect(dsource,"","")
=SQLSetProp(handle,"Asynchronous",.T.)
**** The customer table must be in the
sql="select * from customer"
waittime=2
start=SECONDS()
retcode=SQLExec(handle,sql)
**** This DO WHILE code below is never executed because retcode=1....
**** i.e., the DBExec() above returns all the results synchronously.
DO WHILE ((retcode=0) AND (SECONDS() - start < waittime))
retcode=SQLExec(handle,sql)
ENDDO
IF (retcode= 0)
retcode=SQLCancel(handle)
ENDIF
IF (retcode < 0)
val=AERROR(atmp)
errval=atmp(1,1)
errmsg=atmp(1,2)
WAIT WINDOW STR(errval)+': '+errmsg
CLEAR
ENDIF
***** Remove the connection
=SQLDisconnect(handle)
Additional query words: VFoxWin FoxWin 2.50 ck 3.00 2.50a
Keywords: kbinfo kbcode KB114355