Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
When Close Tables Doesn't
Message
From
12/07/2005 18:19:01
 
 
To
12/07/2005 16:57:49
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01031910
Message ID:
01031956
Views:
21
This message has been marked as the solution to the initial question of the thread.
Could the other process be creating a "filtered result set" in a Select-SQL statement?

I've found that a table in such a state (acting as a cursor but really a filtered result set) cannot be closed.

good luck


>I have a small executable that is a conversion utility. It calls two other apps. In most cases tables are opened, a process is run, and then tables are closed using CLOSE TABLES in VFP9. For some reason, I have stepped through this and closing tables doesn't. The below code is in the same prg except that openfiles function is in the main calling program of the primary app. Code:
>
>
>=OpenFile(ddir,'POLICY_D','MASTER',.T.,'SYSNUM')
>=OpenFile(scdir,'POLICY_D','SCMAST',.F.,'SYSNUM')
>=OpenFile(ddir,'POLICY_H')
>
>*--Process runs here
>
>CLOSE TABLES && appears to close all tables in the default data session but not alias 'MASTER'
>
>*--the first openfile line below fails because master is still open from above - close tables
>*--did not close it for some reason?  I have stepped through this and each line is processed
>*--but master remains open and the data session is still the default data session
>*--_vfp.autoyield should have any effect here
>
>=OpenFile(ddir,'POLICY_D','MASTER',.F.,'SYSNUM') && master is in still use for some reason?
>=OpenFile(scdir,'POLICY_D','SCMAST',.F.,'SYSNUM')
>
>*--Another process runs here
>
>CLOSE TABLES
>RETURN
>
>*--------------------------------------------------
>FUNCTION OpenFile
>PARAMETERS sDir, sFile, sAlias, bZap, sOrder
>
>IF EMPTY(sAlias)
>   sAlias = sFile
>ENDIF
>
>llFailed = .F.
>
>TRY
>
>   SELECT 0
>   USE (sDir+sFile) EXCLU ALIAS (sAlias)
>
>CATCH TO ErrObj
>
>   MsgText = "Error "+TRANSFORM(ErrObj.ERRORNO)+": "+;
>      ErrObj.MESSAGE +;
>      CHR(13)+CHR(13)+;
>      IIF(ErrObj.ERRORNO = 1705,'Could not open the file:'+CHR(13)+;
>      sDir+sFile+CHR(13)+'excusively.'+CHR(13)+CHR(13),;
>      'Could not open the file:'+CHR(13)+;
>      sDir+sFile+CHR(13)+CHR(13))
>   MESSAGEBOX(MsgText, 0+16+4096,'Error')
>   llFailed = .T.
>
>ENDTRY
>
>IF !llFailed
>   IF !EMPTY(sOrder)
>      SET ORDER TO TAG (sOrder)
>   ENDIF
>
>   ON ERROR DO sysErrMess IN MAIN WITH ;
>      ERROR(), MESSAGE(), MESSAGE( 1), PROGRAM(), LINENO()
>
>   IF bZap
>      ZAP
>   ENDIF
>
>   RETURN
>ELSE
>
>   ON ERROR DO sysErrMess IN MAIN WITH ;
>      ERROR(), MESSAGE(), MESSAGE( 1), PROGRAM(), LINENO()
>
>   StopLoop = .T.
>
>ENDIF
>
>RETURN
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform