Re: Row cannot be located for updating error (ADO)

From: Tom Dalton (daltonth_at_telkomsa.net)
Date: 10/06/04


Date: Wed, 6 Oct 2004 21:40:35 +0200

Brian,

Thanks for your prompt reply it is greatly appreciated. The data that I
lookup is a query with no joins at all it is one table queried with one or
two parameters to bring back the data needed according to a previous
selection made. The dataset I am writing to is the table's dataset (again
no joins), however the table is joined to the customer data. I think I
understand what is the case, the actions i.e.
(CalibrDataMod.JobProfiles.FieldByName('KnlSelect').Value := DBEdit1.Text;
"DBEdit1 the field double clicked) in the OnDoubleClick event is writing
directly to the database but the data aware controls are writing to the
dataset. Am I correct in this respect? I will try the suggested change in
the onShow or OnCreate form event. Is there any sense in changing is back to
its default value at any stage?

Thanks again

Tom Dalton
Calibr8

"Brian Bushay TeamB" <BBushay@Nmpls.com> wrote in message
news:rcp6m09qiqcs86581eh6biki1uo138lf24@4ax.com...
> >I am using Delphi 7 pro with an ADO connection to an MS Access data base.
> >In a form with a combination of text boxes and radio groups on a tabbed
page
> >I have a double click event that writes a value to the text box
(basically a
> >lookup value) dependant on the users selection this is then saved to the
> >database (i.e. post) the next selection is also saved in the same way.
Then
> >the radio group that has a selection of two options is a bound control
(i.e.
> >a data control with its data set set to the same data set as we were
writing
> >to in the double click event) once clicked, the application reports an
error
> >"Row cannot be located for updating. Some values may have been changed
since
> >it was last read"? I don't seem to get rid of this problem does anyone
have
> >any pointers?
> I assume your query is a Join using fields that come from the table your
lookup
> value is being saved to.
> When you are using a client dataset ADO must be able to find the record in
the
> database to update. The default way to do this is to use all the field
values
> in the clientdataset record to match to a record in the database.
> When you change one of these field values in the database you can no
longer get
> this match.
> You could Requery your dataset so that the values in it all match what is
in the
> database or you can use the ADO "Update Criteria" property to change the
way ADO
> finds the record to update to just use keyfield values
>
> ADODataSet1.Properties['Update Criteria'].value :=adCriteriaKey;
> http://support.microsoft.com/default.aspx?scid=kb;EN-GB;q190727&GSSNB=1
> --
> Brian Bushay (TeamB)
> Bbushay@NMPLS.com



Relevant Pages