Article ID: 129077
Article Last Modified on 2/12/2000
LOCAL nViews, cCity
OPEN DATA SYS(2004) + 'samples\data\testdata'
* Creates an array that holds the names of all the views in the database
nViews = ADBOBJECTS(a_View, 'VIEW')
IF nViews > 0
IF ASCAN(a_View, 'COMPANY_VIEW') > 0
DELETE VIEW Company_view
ENDIF
ENDIF
cCity = 'London'
CREATE SQL VIEW Company_view AS ;
SELECT cust_id, company, city ;
FROM customer ;
WHERE city = ?cCity
IF USED('Company_view')
USE IN Company_view
ENDIF
* Open the view without downloading the data:
SELECT 0
USE Company_view NODATA
BROWSE NOWAIT
=MESSAGEBOX(IIF(RECCOUNT() = 0, 'No data yet.', 'Now we have data'))
* Download the data:
?REQUERY()
SHOW WINDOW Company_View REFRESH
=MESSAGEBOX(IIF(RECCOUNT() = 0, 'No data yet.', 'Now we have data'))
* Modify the value of the parameter:
cCity="Paris"
SELECT 0
USE Company_view AGAIN NOREQUERY
BROWSE NOWAIT
=MESSAGEBOX("City is "+cCity+chr(13)+"Query is not updated")
?REQUERY()
=MESSAGEBOX("City is "+cCity+chr(13)+"Query is updated")
Additional query words: VFoxWin
Keywords: kbcode KB129077