Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clearing Views/Cursors
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Clearing Views/Cursors
Miscellaneous
Thread ID:
00318092
Message ID:
00318092
Views:
50
I programatically create a view from a parametised query.
Once I have pulled the data from this and appended it to a local table drop the view.
However they are not being detroyed - when the program finishes you can select and brow the views created.
DO WHILE .NOT. EOF()
StartDate = ALLTRIM(THISFORM.Text2.TEXT)
EndDate = ALLTRIM(THISFORM.Text3.TEXT)
MSID = msid.msid
Viewname = MSID
CREATE SQL VIEW &Viewname REMOTE;
CONNECTION ConnectionSPS SHARE ;
AS SELECT Sts_metered_kwh.ST_MTS_ID...
...Sts_metered_kwh.kwh_total ;
FROM SPS.Sts_metered_kwh Sts_metered_kwh;
WHERE ;
Sts_metered_kwh.GMT_DATE >= TO_DATE('&StartDate','dd/mm/yyyy');
AND Sts_metered_kwh.GMT_DATE <= TO_DATE('&EndDate','dd/mm/yyyy');
AND Sts_metered_kwh.ST_MTS_ID = '&MSID'

SELECT * FROM &Viewname INTO table mydata
SELECT importsts
APPEND FROM mydata
DROP VIEW &Viewname
SELECT msid
SKIP 1
ENDDO

What can I do to clear the cursor? I only found out when I tried to process a couple of hundred records in the DO WHILE and got a maximum numbers of cursors exceeded error.
Thanks in advance.
Martin
If only everything in life was as reliable as VFP
Next
Reply
Map
View

Click here to load this message in the networking platform