Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
On error
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00768753
Message ID:
00769212
Vues:
21
I use the following code is a prg that is called by my error handler prg to obtain among other things a list of all open tables in all data sessions.

** Display Tables open in datasession
local mTableArray,mTableCount,msetdatasession,mdatasessionlist
Dime mTableArray[1,2]
AUSED(mTableArray)
= strtofile(space(10)+chr(13)+chr(10),datadir+'Error.txt',.t.)
= strtofile("Tables open in current DataSession ("+alltrim(str(set('datasession')))+"): "+chr(13) ;
+chr(10),datadir+'Error.txt',.t.)
= strtofile("Table Alias Record Count Filename"+chr(13)+chr(10),datadir+'Error.txt',.t.)
For mTableCount = 1 to ALen(mTableArray,1)
if !empty( mTableArray[mTableCount,1] )
= strtofile(padr(mTableArray[mTableCount,1],16)+str(recno(mTableArray[mTableCount,1]),8)+' ' ;
+str(reccount(mTableArray[mTableCount,1]),8)+' '+dbf(mTableArray[mTableCount,1])+chr(13) ;
+chr(10),datadir+'Error.txt',.t.)
endif
EndFor
mxlinesadded = .t.
msetdatasession = alltrim(str(set('datasession')))
mdatasessionlist = alltrim(str(set('datasession')))
if _Screen.FormCount > 0
for fc = 1 to _Screen.FormCount
if type('_Screen.Forms(fc)') = 'O'
if wexist(_Screen.Forms(fc).name)
if at(alltrim(str(_Screen.Forms(fc).datasessionid)),mdatasessionlist) = 0
if AUSED(mTableArray,_Screen.Forms(fc).datasessionid) > 0
mdatasessionlist = mdatasessionlist + ':' + alltrim(str(_Screen.Forms(fc).datasessionid))
set datasession to (_Screen.Forms(fc).datasessionid)
= strtofile(space(10)+chr(13)+chr(10),datadir+'Error.txt',.t.)
= strtofile("Tables open in DataSession ("+alltrim(str(_Screen.Forms(fc).datasessionid)) ;
+"): "+_Screen.Forms(fc).name+chr(13)+chr(10),datadir+'Error.txt',.t.) = strtofile("Table Alias Record Count Filename"+chr(13) ;
+chr(10),datadir+'Error.txt',.t.)
For mTableCount = 1 to ALen(mTableArray,1)
if !empty( mTableArray[mTableCount,1] )
= strtofile(padr(mTableArray[mTableCount,1],16) ;
+str(recno(mTableArray[mTableCount,1]),8) ;
+' '+str(reccount(mTableArray[mTableCount,1]),8)+' ' ;
+dbf(mTableArray[mTableCount,1])+chr(13)+chr(10),datadir+'Error.txt',.t.)
endif
EndFor
endif
endif
endif
endif
endfor
endif
if not empty(msetdatasession)
mcommand = "set datasession to " + msetdatasession
&mcommand
endif
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform