Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create an SQL view in a prg
Message
De
05/06/1998 12:06:49
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00105076
Message ID:
00105195
Vues:
25
>Sylvia,
>
>I have one file in a project where I store all of the code created views each one looks something like:
>
>
create sql view windowsview as;
>SELECT windows.iid, cWindowLetter,;
>  nquantity, nwidth, nheight,;
>  ncostpersqft, nPrice, lnameplate,;
>  lprotectivecovering, llightbox, lframes,;
>  lfinalmeasurement, ;
>  CodesStyle.cValue as cWindowStyle, ;
>  CodesTop.cValue as cWindowTop ;
>  FROM  windows ;
>  INNER JOIN codes as CodesStyle;
>     ON  Windows.istyle = CodesStyle.iID;
>  INNER JOIN codes as CodesTop;
>     ON  Windows.itopshape = CodesTop.iID ;
> WHERE Windows.iproject = ?projects.iID ;
> order by cWindowLetter
>
> It works just great. I posted my dbcviewprop utility in another thread a few days ago that copies the properties of the underlying fields over to the view properties.
>
>>I need to create a view for a grid which joins 4 tables. In looking at other threads on the topic, I realize I have to do this outside of the view designer. The recommendation was to cut and paste the SQL code created from the view designer and modify it to fix the way the joins work and put it in a prg or a class. I understand that for the SQL part, but I'm still not sure how to code the rest of the view outside of the DBC, that is, the other parts which create the rest of the definition so I can use this in my grid as I would something I created in the view designer. I thought views had to reside within the DBC. Perhaps I'm thinking this is more complicated than it is, but I would appreciate if someone who does this can give me an example.

Dave -

Thanks, I saw your program a few days ago, but wasn't sure exactly what it was for. I guess I need to ask a few follow-up questons. Am I correct in that your syntax above creates the view itself, but it's barren of table specific stuff and that's what your Dbviewprop does? Also, I'm not sure I understand what you mean when you say "If I ever change a view, I just highlight that section of code, rightclick and tell it to Execute Selection." What exactly does this accomplish?

Thanks,

Sylvia
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform