Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loop through datasessions
Message
De
21/03/2003 13:17:17
 
 
À
21/03/2003 12:25:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00768648
Message ID:
00768697
Vues:
25
to everybody:

after some talk with Fred and discovering there is no way get a valid list of datasessions in VFP6, i have decided to write a function to act like the ASESSIONS() in Vfp7 and up. Here is what i came up with.
This function will test 50 datasession numbers obove the last valid DS found which should cover all (i hope). if any one can use it - feel free to add this to your project.
* *** begin test
clear
DIME a_UsedDS(1,1)
NumOfDSFound = ASESSIONS(@a_UsedDS)
?NumOfDSFound
DISPL MEMO LIKE a_UsedDS
return
* *** end test

* *** **********************************************************************
* *** ASESSIONS()
* *** by Gunnar Philipp
* *** 03/21/2003
* *** **********************************************************************
FUNC ASESSIONS
   LPARA ;
      ArrayPointer
   LOCAL ;
      ReturnValue, ;
      i, ;
      MaxLoop, ;
      GotError, ;
      OldError, ;
      OldDS

   * *** set var
   OldDS		= SET("datasession")
   ReturnValue	= 0
   MaxLoop		= 50
   OldError	= ON("error")
   ON ERROR GotError = .T.

   * *** proccess
   FOR i=1 TO MaxLoop
      GotError = .F.
      SET DATASESSION TO i
      IF GotError = .F.
         * *** existing datasession
         MaxLoop = MaxLoop + 1
         ReturnValue = ReturnValue + 1
         DIME ArrayPointer(ReturnValue, 1)
         ArrayPointer(ReturnValue, 1) = i
      ENDIF
   ENDFOR

   * *** clean-up
   ON ERROR &OldError
   SET DATASESSION TO OldDS
   RETURN(ReturnValue)
ENDFUNC
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform