Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with record update on insert trigger
Message
De
01/02/2012 04:02:11
 
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 9 SP2
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01534183
Message ID:
01534190
Vues:
37
>I have two tables with a one to many relationships. I have set buffer mode to 5 on the detail table. I want to execute code to update a field within the record that is currently updated on the insert trigger. The field will hold an unique number that I will assign as each record is updated. I am doing this since I want the number I assign to run in sequence with no gaps and the number is alphanumeric.
>However, when I try to replace the field with the value I have generated i get a message that the cursor is readonly.
>
>How can I replace the value of the current record being updated (I use Tableupdate command) before the physical update is executed without getting the readonly record?
>
>Thanks in advance.
>
>Stuart

Stuart,

It is impossible to update a field in a table in its trigger. ( You can update other tables, but not the table that fired that trigger)

The only place to update the record is in its table validation rule, which fires before the triggers

A way to detect new records in the table validation is - if memory serves - to check the oldval('field') which will be null - supposing nulls are not allowed for your field
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform