Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I have a basic question about work areas
Message
De
12/02/2004 08:51:47
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
11/02/2004 10:36:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00875672
Message ID:
00876624
Vues:
18
>Thanks for your response, Hilmar! I do understand that there is a Foxpro SELECT command, which differs from an SQL select statment. My confusion is about whether or not I have to use the Foxpro SELECT and what it really does.

In some cases, a work area is selected automatically. For instance, a SELECT - SQL will automatically open the table in a new area. In other cases, you have to select a work area explicitly.

> In my application, I have a form which has 1) a listbox showing a list of names, 2)a textbox for somebody to type in their name. That for also has a Submit button that they press to have their name added to a table(a .dbf file) in some temp directory(on a PC platform running windows2000, foxpro version 8). The init function of the form has only the sql query"
> select names from "c:\temp\peoplesnames.dbf" into array nameslist
> and then I use additem calls to populate the listbox with nameslist contents.
>
>The click funcion of the submit button contains only these sql statements:
> select * from "c:\temp\peoplesnames.dbf" into table "c:\temp\work.dbf"
> insert into "c:\temp\work.dbf"(names) values(thisform.nametxtbox.value)
> select * from "c:\temp"work.dbf" into table "c:\temp\peoplesnames.dbf"
>
>And this system seems to work just fine. Since I haven't used any foxpro
> SELECT 0
> USE "c:\temp\whatever table name"
>commands, I left to wonder what those commands really do.

Select a new work area, and open a table.

> Do they just establish some alias? or what? Or does my direct usage of the SQL statements implicity execute that which the SELECT 0/USE "tablenames" commands do?

SELECT 0 will select a new work area. Let's say your table is named Table1.

Assuming VFP decided to use work area 5; you can later use one of the following to re-select this table:

SELECT 5 (Not recommended, because VFP may use any area. Also, this is hard to read.)

SELECT Table1 (This is the recommended way: select the table alias.)

The alias may be the same as the table name, or you may assign another alias with the ALIAS clause, for instance:
select 0
use 2003_June alias SelectedMonth
...
select SelectedMonth
HTH,

Hilmar.

>Thanks again, and any insight would be deeply appreciated. Once I get a handle on this I can move onto my more interesting and confusing questions about automatic vs manual record vs table locking! Paul C.

My introductdory article on buffering (http://www.utmag.com/July2002/Page6.asp) explains how record locking is usually handled in VFP.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform