Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strange behavior with Select into Cursor
Message
De
19/03/2006 07:06:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01105635
Message ID:
01105640
Vues:
14
>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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform