Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question about views
Message
De
28/04/2006 17:45:54
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Question about views
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
01117697
Message ID:
01117697
Vues:
48
How should the following situation be handled?

The primary key in a table is assigned through a function, through its default value.

In a parameterized view (local view), the primary key field is marked as a primary field, and is not updatable. All other fields are updatable.

When the user creates a new record (the datasource is the local view), and saves it, the table receives its PK correctly (through the default value), and all other fields get updated correctly. However, the PK in the view still has the value zero, since no data is returned from the view to the table. Therefore, if the user does changes to the newly created record, these changes can't be saved, since the PK is invalid. There are also a few other problems, related to the missing PK in the view.

If, on the other hand, the user closes the form (the one that uses the p-view) and opens it again, the data is read correctly, and the record can be saved. Also, I might do a requery(); but it seems inefficient to requery() the entire set of data every time a single record is saved (only for new records). I thought there must be another way.

I think there might be some bad design in the structure explained above, but I can't spot it.

TIA,

Hilmar.
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)
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform