Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I access another Data Session without selecting it
Message
 
 
À
09/01/2001 12:09:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00461208
Message ID:
00461266
Vues:
13
>The help topic for it says.
>
>SET DATASESSION is typically used to debug forms, and should not be issued when a form is active.
>
>I am hoping that this is wrong and that I can use it with caution.

Hi Mark,

We have this procedure in our main wgutility procedure file:
*  Description.......: Creates a private datasession and an object by which you can control it.
*  Calling Samples...: DO CREATEPRIVATEDATASESSION WITH "oReportData"
*                          : Use "RELEASE <object name> to close (i.e. RELEASE oReportData).
*  Parameter List....: tcclassname = Name of datasession object created.
*  Returns...........: Nothing
*  How to use           : After creating the object (passed parameter).  Change your datasession to the one ;
*                          : created by typing SET DATASESSION TO oReportData.datasessionid.
*                          : Then open any tables you need and process.
*                          : When your done, you need to move back to your previous work area like:
*                          : "SET DATASESSION TO oReportData.ppriordatasession".  Then release the object ;
*                          : "RELEASE oReportData
*                          :
*  Properties           : ppriordatasession = Holds the datasession id of the datasession you were in ;
*                          : at the time of creating the object.
************************************************************
procedure CREATEPRIVATEDATASESSION
parameter tcClassName

*--- Check if already exists.
if type(tcClassName)="O"
     return
endif

public &tcClassName

&tcClassName = createobject('privatedata',set('DATASESSION'))

define class privatedata as session
     ppriordatasession = set('DATASESSION')

     procedure init
     parameter tnpriordatasession

*--- scoped to data session...
     set deleted on
     set century on
     set talk off
     set multilocks on
     set exact on
     set ansi on
     set near off
* --
     this.ppriordatasession = tnpriordatasession
endproc


*!*          PROCEDURE setdatasession
*!*               PARAMETER tndatasession
*!*               This.ppriordatasession = SET('DATASESSION')          && Save current datasession.
*!*               SET DATASESSION TO tndatasession                    && Change datasessions
*!*          ENDPROC

enddefine
This idea works, but I prefer to just use session class directly, if I need a separate DS for some programs...
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform