Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TableUpdate question, I think...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
TableUpdate question, I think...
Divers
Thread ID:
00672014
Message ID:
00672014
Vues:
38
I have a base table, wbOBSout.dbf
which I reference on my form via a view, vWBobsOut_OrderItems (it's a sub-set of my OrderItems record)

My view has SQL updates selected and all fields marked as writable and in my form's data environment the view is marked as NoDataOnLoad and Optimistic Table Buffered.

When the user clicks a report button or exits the form a SaveAll method executes. In this SaveAll method vWBobsOut_OrderItems records are created/updated from the current contents of the view associated with the OrderItems table. Then I issue a
TableUpdate(2,.T., "vWBobsOut_OrderItems", "problemrecs")

What I want to happen is,
If a record in vWBobsOut_OrderItems is new to wbOBSout.dbf, then create the corresponding record in wbOBSout.dbf,
but
If a record in vWBobsOut_OrderItems exists in wbOBSout.dbf, then update the corresponding record in wbOBSout.dbf

What happens instead is I get an error message about the uniqueness of the key being violated, and wbOBSout.dbf ends up with duplicate records in it.

Question: What am I doing wrong, and what should I do to achieve my goal?

TIA,
Rick Liebespach
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform