Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I use USE and SELECT for the same table in one form?
Message
De
27/11/2004 12:17:25
 
 
À
27/11/2004 07:51:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00965095
Message ID:
00965110
Vues:
9
>i thing not clear to me though is the USE and SELECT command.. i got problem in accessing the same table if i happened to execute both command within one formset.
>help!!!!

The key to understanding this is workareas. Each open table uses a workarea. You can refer to a workarea by number (1 to 32767), letter (A-J for the first 10 and W11, etc., after that) or by the alias of the table open in that workarea. Using the alias is the best choice.

There's always one workarea selected. When you first start VFP, it's workarea 1, but as noted below, you can move around. Many commands operate, by default, on the table in the current workarea. However, most of those commands can also be instructed to work in a particular workarea by adding the IN clause. For example:

USE Customer IN 0 SHARED

USE opens a table and makes it available. If you don't specify, it opens the table in the current workarea. The best practice is to add IN 0 to the USE command to open the table in the next available workarea. USE has a number of other clauses that determine how the table opens (shared or exclusive, for example).

SELECT changes workareas. You can give it a letter, number or alias and it makes the specified workarea the current workarea. SELECT 0 makes the first unused workarea current. Another way to open a table is to go to an available workarea and then USE it:

SELECT 0
USE Customer SHARED

This isn't quite the same as the example above because in this case, the workarea containing Customer is now current. In the USE ... IN 0 example, you're still in the same workarea as when you started.

On another note, unless you're working on an application that already uses formsets, I'd advise you to stay away from them. They complicate things without adding any value.

Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform