Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Am I misusing TableUpdate()?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00261437
Message ID:
00262723
Vues:
24
>>>I have a remote view of a VFP DBC table. I inserted several records from arrays, etc. into the view. Now I issue tableupdate() at the click of a form button and nothing happens - no records are written to the table.
>>>
>>>Am I misusing the function because I didn't read from the table into the view first? What's the best way for getting the view info into the table?
>>
>>NO, you don't need to REQUERY the view before updating from it. Your problem lies elsewhere. In addition to Jim's advice, check to make sure that the view is set to updatable, a key field is specified, and the proper fields are marked as updatable.
>
>
>
>All of the fields are set in the view as updatable (even the primary key field), and when creating a new record things now insert kind of OK. However, if I edit a record, VFPODBC complains "uniqueness of primary key violated" when I know it hasn't been. It's like although I am doing a
> tableupdate(2,.t.,'CustUpdate')
>VFP is trying to append/insert, which would violate uniqueness. I just want to replace the record. In the view's properties, I (via GUI) tried update via SQL update and update via SQL delete/insert - neither worked.
>

Delete/Insert approaches are likely to fail on VFP datatables with a primary or candidate key that does not take into account the DELETE() status - you actually have at least two instances of the primary key in the file, one (or more) deleted, and at most 1 'live' occurance. The uniqueness test for the index doesn't take SET DELETED into account, so without a FOR ! DELETED() filter on the primary key field; its the same problem of key recirculation in a VFP table that's been in so many discussions recently.

>What did I miss this time?
>
>Thanks.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform