Re: TADOTable exception when post second time




>At the first time to press the save button, it is fine.
>Then I press the edit button again, edit the values in the data-aware
>components, and press the save button. An exception occurred:
>'exception class EOleException with message 'Row cannot be located for
>updating. Some values may have been changed since it was last read'
>
>I tried different fields, it seemed happened to varchar field the most.

When you use a clientside cursor ADO must be able to figure out what the record
you want to update in the database is. The default way to do this is to match
the before edit values of all the fields at the client with all the field values
in the database.
The first time you post the data the preEdit client values find a match on the
server and the second time they don't
So some value your record is not updating with the exact value from your client
if you are using a trigger to change values in the database that would explain
this behavior. I have also seen it in some cases with DateTime fields where
milliseconds get trimmed off.

You can change the default behavior to instead used just the key field vales.
To do this use the Update Criteria property

set the 'Update Criteria' dynamic property:-

ADODataSet1.Properties['Update Criteria'].value :=adCriteriaKey;

Your choices are adCriteriaKey, adCriteriaAllCols (BDE's default),
adCriteriaUpdCols (ADO's default) and adCriteriaTimeStamp. Search the
Platform SDK for more details.

This property needs to be set after the dataset has opened
http://support.microsoft.com/default.aspx?scid=kb;EN-GB;q190727&GSSNB=1


--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.