Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange behavior with Select into Cursor
Message
From
19/03/2006 07:06:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01105635
Message ID:
01105640
Views:
13
>I tried the following code:
>Select * from MyDbf into Cursor MyCur
>Select * from MyCur ---> Give an error
>
>Select * from MyDbf into Cursor MyCur where .t.
>Select * from MyCur ---> works fine
>
>Am I missing something here...how can I get consistent results ??
>
>Regards,
>Gerard

Sometimes Visual FoxPro decides to use a filter on an existing table, instead of creating the cursor as a separate table. In this case, the cursor can't be used in subsequent SELECT statements.

To avoid this, use the NOFILTER clause:
select * from MyDbf;
  into cursor MyCur;
  nofilter
select * from MyCur
This requires VFP 6 or later (or was it 5? - not sure); in earlier versions, a workaround is to add an additional field, which is not part of the table:
select *, .T. as UnusedField;
  from MyDbf;
  into cursor MyCur
select * from MyCur
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform