Re: Help on resolving record conflicts with ADO



A while ago it was suggested that I try this:

ADODataSet1.RecordSet.ReSync(adAffectCurrent, adResyncAllValues);
ADODataSet1.UpdateCursorPos;
ADODataSet1.Cancel;
Action := daAbort;

If my select statement is from 1 table, the above code works fine, but if I
include any fields from another table through a left outer join (the other
table's field is for display purposes only) then the above code crashes with
'Key value for this row was changed or deleted at the data store. The local
row is now deleted.'. My select statement contains the primary key for the
table I want to update, and only one field from the other table. I've tried
BetterADO with no success. I'm wondering if the problem is how I'm building
the select statement, but I don't see any other way to do what I need to do.

SELECT table1.id, table1.name, table1.amount, table2.displayfield FROM
table1 LEFT OUTER JOIN table2 ON table1.id = table2.
id

"Brian Bushay TeamB" <BBushay@xxxxxxxxx> wrote in message
news:00ssv11sqijdu9uih7tsklldsco1midgtq@xxxxxxxxxx

An additional note on this issue:

I've been doing testing for several hours since my original post. It
seems
that if I whittle down my original sql statement to just 1 table, the
conflict-resolution code I have in my PostError event works. So that
leads
me to believe that there's a problem with uniqueness with my query. The
odd
thing is that the query simply tacks on 1 field from another table - I'm
left outer joining the other table, and incidentally there can only be a
max. of 1 joined records per primary table. I'm using the key from the
primary table in the query.

I've also tried BetterADO, but it has not helped get passed my section of
code for re-syncing. I may not be using it properly, but I was reading
somewhere that setting the Primary Table property (something like that) in
the control (BetterADO) would eliminate any question about which table was
the primary table, so any updates on that table should work properly.

This may help - it seems that even though I'm specifically setting
['Update
Criteria'].Value := adCriteriaKey, when I do Action := daRetry I am faced
with the exact same PostError problem. It's as if the setting of the
update
criteria didn't take.
Does you code work if you leave off the Resync?
If it does than I think you may need to add a Resync Command
Joins don't resync properly with out a Resync Command
TbetterADODataset has the Resync_Command property to make this easy to do.
--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx


.



Relevant Pages

  • Re: Help on resolving record conflicts with ADO
    ... that if I whittle down my original sql statement to just 1 table, ... me to believe that there's a problem with uniqueness with my query. ... the control (BetterADO) would eliminate any question about which table was ... If it does than I think you may need to add a Resync Command ...
    (borland.public.delphi.database.ado)
  • Re: Help on resolving record conflicts with ADO
    ... I tried my query in enterprise manager. ... I try to change the same row/column in the 2nd window I get all kinds of ... the control (BetterADO) would eliminate any question about which table was ... If it does than I think you may need to add a Resync Command ...
    (borland.public.delphi.database.ado)