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:
00769318
Vues:
22
hello mike

thank you for you imput, this approach is going toards the suggestion from hilmar earlier in this thread. however, i am afraid this solution is not preceise enough. the following is your code with a small test prog upfront. just run this on a Vfp6 Sp5 machine.

Now, in this test i am taking advantage of a bug which i don't know if it is only on my machine or if it is global, but in either case i think you'll see what i am talking about. the bug i am refering to, is that after you close the class browser, vfp leave datasession 3 open. check it out and let me know what you think.

thanks again for your reply.
* *** *************************************************************************************
* *** prog to test below function
* *** *************************************************************************************
* *** start the class browser
DO (_BROWSER)
* *** close it (this leaves datasession 3 open)
* *** (you can even leave it open, because the following prog
* *** does not acknowledge the default (vfp screen) datasession if it
* *** is not selected). this leaves the question what happens to form with .Visible = .f.
* *** temporarly - are they beeing checked?
_SCREEN.ACTIVEFORM.RELEASE
* *** now we got 2 datasessions
SET DATASESSION TO 1
SELE 0
CREATE ;
   CURSOR Temp1 ;
   (fld1   C(1))
SET DATASESSION TO 3
SELE 0
CREATE ;
   CURSOR Temp2 ;
   (fld1   C(1))

GetAllTables()
MODI FILE ERROR.txt
SET DATASESSION TO 1
GetAllTables()
MODI FILE ERROR.txt

SET DATASESSION TO 3
CLOSE DATA ALL
SET DATASESSION TO 1
CLOSE DATA ALL
RETURN
* *** *************************************************************************************
* *** *************************************************************************************

FUNC GetAllTables
   ** Display Tables open in datasession
   LOCAL ;
      mTableArray, ;
      mTableCount, ;
      msetdatasession, ;
      mdatasessionlist

   datadir = ""
   * *** reset error file
   = STRTOFILE("", datadir+'Error.txt', .F.)


   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
ENDFUNC
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform