Board index » delphi » Repost ADO Read Error

Repost ADO Read Error

Hi,

I am getting this error when I update a record - it is really doing my head
in :(  But I think it is more likely my lack of knowledge with ADO.

Project ByteBak.exe raised exception class EOleException with message 'Row
cannot be located for updating. Some values may have been changed since it
was last read'...

Could some one please explain what it means and it might put some light on
the matter.
If not I will post what I am doing.

Regards and thanks in advance.

Dave

 

Re:Repost ADO Read Error


Hello,

as simple as it sound , you did a select statement at ADO Query then some
other unit or other query
changed the data so before trying to change the data use the requery method
of the TADOQuery
(assuming you open an efficient query and not trying to retrieve all the
records by (select * from mytable order by
myfield)

HTH
Yaron,

Re:Repost ADO Read Error


Hi Yaron,

I have a DataModule with a TADOConnection and then a number of TADODataSets
pointing to it, all are set to clUseClient and clStatic cursors.  All
commandTexts are "select * from whatever_table" One is linked using the
Masterfields to the Address TADODataSet.

The links look like this: -

   Address (1/meny) -> Repairs (1/meny) -> Parts.

This is what is happning...

On the repairs form there is an "Add Part" Button that opens up a small form
that shows a list of parts, double click the part and it adds the item to
the Parts Table (linked to the Repairs) using the following code...

If D.ADS_Repairs.State<>dsBrowse then
     D.Lflag:=true;
  D.partsFlag:=true;
  D.ADS_Parts.Append;
  D.ADS_PartsPartName.AsString:=D.ADS_PartsListPartName.AsString;
  D.ADS_PartsPartPrice.AsCurrency:=D.ADS_PartsListPartPrice.AsCurrency;
  D.ADS_Parts.Post;
  If d.flag then
  begin
    d.flag:=false;
    D.CalcIt2;
  end else
    D.CalcIt;

CalcIt is follows:-

Procedure TD.CalcIt;
 Var pTot,vTot,gTot,hTot:real;
Begin
  ADS_Parts.First;
  pTot:=0;
  While Not ADS_Parts.Eof Do
  Begin
    pTot:=pTot+ADS_PartsPartPrice.AsCurrency;
    ADS_Parts.Next;
  End;
  hTot:=ADS_RepairsLabour.AsInteger*30;
  vTot:=Round((pTot+hTot)*17.5)/100;
  gTot:=pTot+vTot+hTot;
  ADS_Repairs.Edit;
  ADS_RepairsPartsCost.AsCurrency:=pTot;
  ADS_RepairsIncVAT.AsCurrency:=vTot;
  ADS_RepairsTotalCost.AsCurrency:=gTot;
  ADS_RepairsHourlyCharge.AsCurrency:=hTot;
  If Lflag then exit;
  ADS_Repairs.post;    (a)
End;

LFlag leaves the repairs in edit mode if they were in it to start with...
But it posts it ok...

When I press the close button on the "OnClose" Event I have the following.

  Repair:=nil;
  if D.ADS_Repairs.State<>dsBrowse then begin
    if MessageDlg('Save Changes',
                   mtConfirmation, [mbYes, mbNo], 0) = mrYes then
        Begin
          d.ADS_Repairs.Post;
          d.Lflag:=false;
        End
        Else D.ADS_Repairs.Cancel;
  End;

It's at this point that the error occurs if I say yes to save... the problem
is it shouldn't ask me to save - the program has saved it at line (a) above.

I hope this makes sense - if you want pas files to look at (Am assuming a
lot here and forgive me for my boldness) I can email them to you...

I hope you can help and I realise that it is my ignorance that is the
problem - I have looked at all the books I have - no joy.

Regards

Dave

Quote
"Yaron Nahum" <ya...@mikunim.co.il> wrote in message

news:3d0c9f49$1_2@dnews...
Quote
> Hello,

> as simple as it sound , you did a select statement at ADO Query then some
> other unit or other query
> changed the data so before trying to change the data use the requery
method
> of the TADOQuery
> (assuming you open an efficient query and not trying to retrieve all the
> records by (select * from mytable order by
> myfield)

> HTH
> Yaron,

Other Threads