Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to update multi table views?
Message
 
 
À
01/06/1999 10:29:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00224921
Message ID:
00224981
Vues:
20
>1. I have a view that is created from some fields from 2 tables. This is presented to a user in a grid. How do I write back the changes to the two tables from the view??
>
>2. Has someone got a simple class/code to edit a table using the VFP commands - Begin Trans Rollback/Update Endtrans. Currently I use Scatter / gather and want to use the new commands in a DBC.
>
>No,not VFP wizards please.
>
>Thanks
>
>Bernard

In each table, you need to have a field that serves as a primary key. I use a meaningless field of integer type for my primary key in all my tables. I also have a Kounters table that has a record for each table I have that requires a PK. The Kounters table has a field for the TableName, the field name needing a return value, and an integer field with the last used number.

My default value for these fields is a function called GetPrimaryKey(table_name, field_name). Some of my tables have a second integer field that I use a generated number for, although this is very rare. That is why I have the field name in the Kounters table.

My GetPrimaryKey function finds the table_name and field_name passed to the function in the Kounters table, locks that record, adds 1 to the last used number, replaces that value in the table, unlocks the record, then returns the generated number.

As for your second question, start by learning more about the following VFP functions: TableUpdate, TableRevert, GetNextModified, GetFldState, CurVal, OldVal.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform