Board index » delphi » Record not found or changed by another user ERROR

Record not found or changed by another user ERROR

Hi!

I encounter a error :
Record not found or changed by another user.

I have MySQL 3.23.51 and Delphi 6

4x  Queries -> DSP ->CDS -> DS

In all are keyfields and they are under Query pfInKey TRUE and Required
False
DSP has updatemode upWhereKeyOnly

In CDSAfterDelete and AfterPost I have CDS.Applyupdates(0);

The tables have varchar, integer, "sql datetime" and text (memo) fields.

The problem comes up when make for example this operations :
 1. Delete Record (delete)
 2. Create Record (insert)
 3. Edit Record (post)        ->>> HERE I GET THE ERROR MESSAGE

Please HELP ME !! I need it very urgently !!!

Thank you!
Karol Martinka

 

Re:Record not found or changed by another user ERROR


And sometimes I get an error Out of SYNC, too!! I'm argued !
Quote
"Karol Martinka" <ka...@freeland.sk> wrote in message

news:3ea89a76@newsgroups.borland.com...
Quote
> Hi!

> I encounter a error :
> Record not found or changed by another user.

> I have MySQL 3.23.51 and Delphi 6

> 4x  Queries -> DSP ->CDS -> DS

> In all are keyfields and they are under Query pfInKey TRUE and Required
> False
> DSP has updatemode upWhereKeyOnly

> In CDSAfterDelete and AfterPost I have CDS.Applyupdates(0);

> The tables have varchar, integer, "sql datetime" and text (memo) fields.

> The problem comes up when make for example this operations :
>  1. Delete Record (delete)
>  2. Create Record (insert)
>  3. Edit Record (post)        ->>> HERE I GET THE ERROR MESSAGE

> Please HELP ME !! I need it very urgently !!!

> Thank you!
> Karol Martinka

Re:Record not found or changed by another user ERROR


Hello, co-frustrated dbExpress user(s),

I have a very simillar problem.

I use MySQL 3.23.56 on WinXP Pro, SP1
I use Delphi7Pro, with components TSQLDataset, TDatasetProvider,
TClientdataset and TDataSource.

Seemingly at random I receive the errors:

- Commands out of sync;  You can't run this command now

and

- Record not found or changed by another user.

Solutions I've tried:
- It doesn't make a differenence whether I use TSQLTable/Query or
TSQLDataset components, although at first it appeared to work better with te
TSQLDataset.
- It doesn't make a difference wheter to use upWhereChanged / upWhereAll /
upWhereKeyOnly is used (I tried all combinations)

I'm very much in need for a solution, with al the problems I experience in
the transition from Advantage/D5Pro to MySQL, dbExpress, D7Pro I have lost
already a complete month.

My gratitude will approach infinity for anyone who can give me advice.

Greetings, Remco Bruinsma, Bugando.com

Re:Record not found or changed by another user ERROR


Quote
> - Commands out of sync;

MySQL doesn't support more than one active cursor per connection. So, you
get this error if  there is a open cursor which is not fetched and you are
trying to open a new cursor in MySQL.

A possible workaround is to see if you have any dataset open and not fetched
till EOF before opening another one.
The AutoClone property is suppose to fix it but there could be a bug in the
dbExpress components you are running into as you say its random.

T.Ramesh.

Quote
"Remco Bruinsma" <r.bruin...@bugando.com> wrote in message

news:3ea97181@newsgroups.borland.com...
Quote
> Hello, co-frustrated dbExpress user(s),

> I have a very simillar problem.

> I use MySQL 3.23.56 on WinXP Pro, SP1
> I use Delphi7Pro, with components TSQLDataset, TDatasetProvider,
> TClientdataset and TDataSource.

> Seemingly at random I receive the errors:

> - Commands out of sync;  You can't run this command now

> and

> - Record not found or changed by another user.

> Solutions I've tried:
> - It doesn't make a differenence whether I use TSQLTable/Query or
> TSQLDataset components, although at first it appeared to work better with
te
> TSQLDataset.
> - It doesn't make a difference wheter to use upWhereChanged / upWhereAll /
> upWhereKeyOnly is used (I tried all combinations)

> I'm very much in need for a solution, with al the problems I experience in
> the transition from Advantage/D5Pro to MySQL, dbExpress, D7Pro I have lost
> already a complete month.

> My gratitude will approach infinity for anyone who can give me advice.

> Greetings, Remco Bruinsma, Bugando.com

Re:Record not found or changed by another user ERROR


Thank you for the quick reaction. I think I understand what you are telling
me, but I would be vary thankfull if you could elaborate on these two
questions:
- About the open and not fetched till EOF: should I close other tables,
while keeping the ClientDataset active, e.g. I hava a table persons with
sqldsPersons, dspPersons, cdsPersons and a table companies with
sqldsCompanies, dspCompanies, cdsCompanies. I want to perform a ApplyUpdates
for the cdsCompanies. Am I correct that you suggest I should avoid
sqldsPersons to have an active Cursor?
- How big a chance that my hard labor will not pay off because there is a
bug? Please be frank, I can handle the truth? Right now I'm investigating
the rigourous step to buy a third-party component for native MySql access
(www.scibit.com). I've tried the demo and they work instantly.

"Ramesh Theivendran" <rtheivend...@borland.com> schreef in bericht
news:3ea97bf1$1@newsgroups.borland.com...

Quote
> > - Commands out of sync;
> MySQL doesn't support more than one active cursor per connection. So, you
> get this error if  there is a open cursor which is not fetched and you are
> trying to open a new cursor in MySQL.

> A possible workaround is to see if you have any dataset open and not
fetched
> till EOF before opening another one.
> The AutoClone property is suppose to fix it but there could be a bug in
the
> dbExpress components you are running into as you say its random.

> T.Ramesh.

> "Remco Bruinsma" <r.bruin...@bugando.com> wrote in message
> news:3ea97181@newsgroups.borland.com...
> > Hello, co-frustrated dbExpress user(s),

> > I have a very simillar problem.

> > I use MySQL 3.23.56 on WinXP Pro, SP1
> > I use Delphi7Pro, with components TSQLDataset, TDatasetProvider,
> > TClientdataset and TDataSource.

> > Seemingly at random I receive the errors:

> > - Commands out of sync;  You can't run this command now

> > and

> > - Record not found or changed by another user.

> > Solutions I've tried:
> > - It doesn't make a differenence whether I use TSQLTable/Query or
> > TSQLDataset components, although at first it appeared to work better
with
> te
> > TSQLDataset.
> > - It doesn't make a difference wheter to use upWhereChanged / upWhereAll
/
> > upWhereKeyOnly is used (I tried all combinations)

> > I'm very much in need for a solution, with al the problems I experience
in
> > the transition from Advantage/D5Pro to MySQL, dbExpress, D7Pro I have
lost
> > already a complete month.

> > My gratitude will approach infinity for anyone who can give me advice.

> > Greetings, Remco Bruinsma, Bugando.com

Re:Record not found or changed by another user ERROR


remco, karol -

no problems with the versions or components you are using that I see.
try some (or all) of the following things to help you isolate your problems:

//***precede  'CDS.post'  with a test of CDS state eg:
IF YourCDS.state in [dsInsert, dsEdit] then YourCDS.post;

//***precede every applyupdates with a test for CDS changes eg:
var errorcount: integer;
IF YourCDS.state in [dsInsert, dsEdit] then YourCDS.post;
IF YourCDS.changecount > 0 then begin
      errorcount := YourCDS.applyupdates(0);
      if errorcount > 0 then [go_process_errors]
end;

//***implement an onreconcileEvent handler for debugging, eg:
uses RecError, ....
procedure YourForm.YourCDSReconcileError(DataSet: TCustomClientDataSet;
     E: EReconcileError; UpdateKind: TUpdateKind;  var Action: TReconcileAction);
begin
   Action := HandleReconcileError(DataSet, UpdateKind, E);
end;

//***make sure all changes to ProviderFlags are made in the TSQLDataSet TFields,
        NOT the TClientDataSet TFields

//***be wary of date/time fields.  if you are using your app (client-side) to note when
        users do something, I recommend using server-generated timestamps instead.

//***check QC and google for all articles relating to your errors.  there are many.

good luck.
-paladin

Quote
"Remco Bruinsma" <r.bruin...@bugando.com> wrote in message news:3ea97181@newsgroups.borland.com...
> Hello, co-frustrated dbExpress user(s),

> I have a very simillar problem.

> I use MySQL 3.23.56 on WinXP Pro, SP1
> I use Delphi7Pro, with components TSQLDataset, TDatasetProvider,
> TClientdataset and TDataSource.

> Seemingly at random I receive the errors:

> - Commands out of sync;  You can't run this command now

> and

> - Record not found or changed by another user.

> Solutions I've tried:
> - It doesn't make a differenence whether I use TSQLTable/Query or
> TSQLDataset components, although at first it appeared to work better with te
> TSQLDataset.
> - It doesn't make a difference wheter to use upWhereChanged / upWhereAll /
> upWhereKeyOnly is used (I tried all combinations)

> I'm very much in need for a solution, with al the problems I experience in
> the transition from Advantage/D5Pro to MySQL, dbExpress, D7Pro I have lost
> already a complete month.

> My gratitude will approach infinity for anyone who can give me advice.

> Greetings, Remco Bruinsma, Bugando.com

Re:Record not found or changed by another user ERROR


Ramesh, Paladin,

I have tried the solutions of the both of you:
- Autoclone is active, also a manual clone command doesn't help
- I've closed all other connections, there can not be another cursor
- I --always-- check for [dsinsert, dsedit] before posting
- the changecount is > 0, this also is not the problem
- Sure I can use the ReconcileError, but that doesn't get my data saved
- I do not use / change the providerflags
- I experience the problems also with ordinary character fields, so it is
not related to timestamps
- Google gave some options, but mainly low-level MySQL-API commands (used
from PHP or Perl), I'm not interested in those, I need the user-level Delphi
components to work.
- If I find anything in QC thats is helpfull I will report it here.

Thank you anyway for your suggestions.

Re:Record not found or changed by another user ERROR


Quote
> - Sure I can use the ReconcileError, but that doesn't get my data saved

    no, but it will alert you to which field(s) are causing problem(s)

Quote
> - I experience the problems also with ordinary character fields

    is the data in these fields actually changing?  (reconcile error can help
    see this also)  -the reason I ask this is that I encountered a bug during
    testing where if I cleared a textbox on a form and re-typed the same
    info back in, I would get this error.  Also, same problem if re-selecting
    the same selection in a dbcombo box.  See QC 2717

however you solve your problem, /please/ post the results here,
so we can all learn...

-pal

Other Threads