Hello,
>>My program establishes a connection with an SQL Server database and utilizes a remote view. The issue arises when I fill the remote view cursor with data and issue a >>TableUpdate. Instead of updating the existing records as expected through the primary key, they are being inserted again as new records. Please what am I doing >>wrong?
Duplicates suggest that cGuid is not a primary or candidate key in the underlying table, or else duplicates would not be possible.
The RV query should return existing row/s with cGuid that matches gckey1. Editing an existing row will yield 1 and 2 in GETFIELDSTATE(-1). If you are seeing 3 and 4 in GETFLDSTATE(-1) then these are appended records, not edited records. This suggests the query is not returning existing records, so the app adds another.
Just for completeness- if the RV returns row/s you update or replace values in the existing record rather than appending, correct?
If so, then I would suggest:
- cGuid needs to be made primary or candidate key in the database.
- check the value of gckey1 if it is not returning records that you know exist. Look for leading/trailing spaces, or length >15 chars.
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us."
-- Shakespeare: Coriolanus, Act 1, scene 1