Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
TableUpdate question, I think...
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement