Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL, Views, and Macro Substitution
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00921296
Message ID:
00921794
Vues:
41
This message has been marked as the solution to the initial question of the thread.
>I am getting an error in the VFP 9.0 Beta when opening a View (at runtime) that is defined by SQL that includes macro substitution like the following:
> select * FROM ji!job WHERE &vcWhere
>
>It doesn't matter whether the variable "vcWhere" is defined or not, I still get a "Syntax Error". If I change the SQL to this:
> select * FROM ji!job WHERE (vcWhere)
>
>the Query Designer seems to handle this OK (providing the variable "vcWhere" is at least defined using the command window).
>
>I'm wondering if anybody else has run into this and if there is another/better solution?
>
>Thanks,
>Paul James

Hi Paul,

In VFP9 it should be used this way:
CLEAR   
CLOSE DATABASES all  
DELETE FILE testMacro.d*  

CREATE DATABASE testMacro    
CREATE TABLE testMacro (f1 I)  
APPEND BLANK
APPEND BLANK

pfilter=".T."  

CREATE SQL VIEW exampl AS SELECT temp.* from testMacro temp where &?pfilter  

?dbgetprop("exampl","View","sql")  

USE exampl NODATA
?RECCOUNT()
RETURN  
Thanks,
Aleksey.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform