Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table, index and multiple relations
Message
 
À
18/02/2005 21:15:25
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8
Divers
Thread ID:
00988168
Message ID:
00997373
Vues:
58
Thanks Hilmar, I have experimented the past weeks with views and this is exactly what I want to use more and more in the future...so thanks again for your detailed help and pointing me to this feature...



>>Hi Hilmar,
>>
>>Yes I'm familiair with queries and have used them a lot.
>
>OK. In this case, views should be easy for you.
>
>First, the basic idea: A view is, in essence, an "updatable query": while a query is read-only, a view can be made updatable. As soon as you save your data, the changes are updated in the underlying tables.
>
>While a query (built with the query designer) is stored in a file with extension .QPR, a view is easiest to manage if it is part of a database.
>
>
  • Open a project.
    >
  • Select (or create) a database.
    >
  • Expand the database in the project manager, and select "Local Views".
    >
  • Click on the button "New...", and then select "New View".
    >
  • Now, you enter the view definition window. This is almost identical with the query manager, which you say that you already know. Add your tables, relate them, etc. For a first test, select all fields from a single table.
    >
  • To make your view updatable, go to "Update Criteria". In the field list, activate the column with the key icon, for your primary key (this must be a column that has a different value for each record). Activate the column with the pencil icon, for all other columns. Warning: if the primary key is not defined correctly, the wrong records can be updated.
    >
  • Click on "Send SQL updates". This is a "master switch": if you forget this, no data will be updated.
    >
  • Save and close the view. It will be saved in your database. I recommend that you give the view a name that starts with "lv_" (for "local view"). If the view is based mainly on a table called "client", call the view "lv_client".
    >
    >To use the view:
    >
  • Make sure the database, which contains the view, is open (open database...).
    >
  • Open the view like a table, for example: use lv_client.
    >
  • Do some changes.
    >
  • Select your preferred buffering mode (usually 3 or 5). Again, this is just like working with a table.
    >
  • Save the changes, and see if the changes were applied to the original table.
    >
    >In many aspects, you work with the view just as if it were a normal table (with buffering enabled). For example, you can make changes with REPLACE, add records with APPEND BLANK, save changes with TableUpdate(), or undo changes with TableRevert().
    >
    >HTH,
    >
    >Hilmar.
    Zakaria al Azhar
    My blog on Actuaris.net
  • Précédent
    Suivant
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform