Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where portion of Select statement
Message
 
 
À
23/09/1999 14:30:23
Pierre Richard
Méthotech Canada Limitée
Kirkland, Québec, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00268128
Message ID:
00268170
Vues:
21
>I need a view based on the user which is currently logged in my app. I have set a global variable containing this user's ID.
>
>Can I use the content of this global variable as in:
>Select * ;
> from MyTable ;
> where MyTbale.User_Id = MyGlobalVariable'sContent
>
>What would be the correct syntax for the where portion of the statement so that I could extract the content of the variable ?
>
>TIA
>

To be more complete, create a parameterized view. The View Designer would produce code like:
Create SQL View v_MyTable as ;
   Select * ;
   from MyTable ;
   where MyTbale.User_Id = ?nUser_ID   && assuming User_ID is numeric
Then all you need to do:
use v_Mytable nodata * this can be in the Form DE with NoDataOnLoad = .T.
local nUser_ID
nUser_ID = oApp.User_ID

* I create an Application object to store all kinds of stuff,
* one of which is a User_ID property to store the ID value
* of the Employee currently logged in

requery("v_Mytable")

If you put the view in the form DE, put SET TALK OFF in the BeforeOpenTables
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform