Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select * from ... into cursor
Message
From
27/07/2009 17:35:08
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01414879
Message ID:
01414889
Views:
43
>I am tring to create a cursor by code in the load method of the form
>
> select * from consultas.dbf into cursor consultas readwrite
>
>message = Alias name already in use !
>
>If I change to
>
>select * from consultas.dbf into cursor consultas_B readwrite,
>
>then I can create it
>
>Is it not possible to have a cursor with the same name of the table as I do in DE interactive cursor creation ?

Perhaps you can open the table first, with another name. You might try it, although I don't see the advantage.

Let's say you give the cursor a different name; what happens is this:
select * from Consultas into cursor TmpConsultas readwrite
Somewhere in the process of creating the cursor, Visual FoxPro will also automatically open the table. If you later check open tables (for example, with the SET command), you will see two aliases: Consultas (the table) and TmpConsultas (the cursor).

This approach, used by Visual FoxPro, has both advantages and disadvantages.

The main advantage is speed. Once the table is open, selecting other data from this table will be much faster.

The disadvantage is that the table may remain open. The programmer should be aware of this. By the way, this is normally not a big problem if your form has a private DataEnvironment (the recommended setting, but not the default): when you close the form, all its oopen aliases (tables or cursors) will also be closed.
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