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

Record not found or changed by another user

I am using Windows XP, D7 with dbExpress to connect to a MySQL db on a linux
server.
I am using sqldataset -> datasetprovider -> clientdataset. I get the same
problem using sqlquery component instead of sqldataset. I am trying to edit
a record in a dataset and when ApplyUpdates(), this error appears. Inserting
records works fine. There are no other users connected and the record is
there. The same code works fine editing 6 other tables in same database. I
am reading the values from a txt file and then updateing a dataset. The
table has a fields with types of, smallint, int, and char. I can throw a
dbgrid on the form and edit and click button to Post , ApplyUpdates(),
Refresh . and works fine. Here is the basic code. I have also tried writing
my on procedure for ApplyUpdates using event BeforeUpdateRecord. Still no
luck. Instead of going through the dbgrid to change the values of fields, I
previously tried working with just the clientdataset.

        dtmdlHHUpdate.clntdtstBTubeLst.Open;

         dbgrdBTube.DataSource.DataSet.RecNo:= StrToInt(btubeSeq);
         dbgrdBTube.DataSource.DataSet.Edit;
          tmpStr:= recFileNextField(line,3);
          dbgrdBTube.DataSource.DataSet.FieldByName('BaitBar_ID')
                .Value:= tmpStr;

          dtmdlHHUpdate.clntdtstBTubeLst.Post;
          dtmdlHHUpdate.clntdtstBTubeLst.ApplyUpdates(0);
          dtmdlHHUpdate.clntdtstBTubeLst.Refresh;

Any ideas, I would greatly appreciate.

Chris

 

Re:Record not found or changed by another user


You probably have a date time field in the record.  Go to your
source dataset and set the TFieldProvider flags.  Have only
your keyfields as part of the Where Clause.

Quote
Chris Mount wrote:
> I am using Windows XP, D7 with dbExpress to connect to a MySQL db on a linux
> server.
> I am using sqldataset -> datasetprovider -> clientdataset. I get the same
> problem using sqlquery component instead of sqldataset. I am trying to edit
> a record in a dataset and when ApplyUpdates(), this error appears. Inserting
> records works fine. There are no other users connected and the record is
> there. The same code works fine editing 6 other tables in same database. I
> am reading the values from a txt file and then updateing a dataset. The
> table has a fields with types of, smallint, int, and char. I can throw a
> dbgrid on the form and edit and click button to Post , ApplyUpdates(),
> Refresh . and works fine. Here is the basic code. I have also tried writing
> my on procedure for ApplyUpdates using event BeforeUpdateRecord. Still no
> luck. Instead of going through the dbgrid to change the values of fields, I
> previously tried working with just the clientdataset.

>         dtmdlHHUpdate.clntdtstBTubeLst.Open;

>          dbgrdBTube.DataSource.DataSet.RecNo:= StrToInt(btubeSeq);
>          dbgrdBTube.DataSource.DataSet.Edit;
>           tmpStr:= recFileNextField(line,3);
>           dbgrdBTube.DataSource.DataSet.FieldByName('BaitBar_ID')
>                 .Value:= tmpStr;

>           dtmdlHHUpdate.clntdtstBTubeLst.Post;
>           dtmdlHHUpdate.clntdtstBTubeLst.ApplyUpdates(0);
>           dtmdlHHUpdate.clntdtstBTubeLst.Refresh;

> Any ideas, I would greatly appreciate.

> Chris

--
Thomas Miller
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork

http://www.bss-software.com
http://sourceforge.net/projects/dbexpressplus

Re:Record not found or changed by another user


Quote
"Chris Mount" <ch...@cookspest.com> wrote in message

news:3e13890b$1@newsgroups.borland.com...

Quote
> I checked the flags, and there is only char and integer fields. Any other
> ideas?

Do you have any triggers on your database end? If you have a trigger that
changes the data, you can get this error also.

Natalie

Re:Record not found or changed by another user


Make sure that your default values on your database match what delphi
defaults to (ie integer =0 char ='') for all not null field types.
Timestamps are problem as well.  Make sure that you set the provider flags
on the server and not on the client to where key.

Ross

Quote
"Chris Mount" <ch...@cookspest.com> wrote in message

news:3e143f3a$1@newsgroups.borland.com...
Quote
> No triggers. Is this maybe some problem with dbexpress, I ran the same
code
> with the scibits demo components to test and it was fine. I would like to
> try to get this thing working with dbexpress components cause the project
is
> about 90% complete.
> Does anyone maybe think if I try upgrading to MySQL 4 may fix this?

> Chris

> "Natalie Brondolo" <natalieb-at-sirs-dot-com> wrote in message
> news:3e1439f6@newsgroups.borland.com...
> > "Chris Mount" <ch...@cookspest.com> wrote in message
> > news:3e13890b$1@newsgroups.borland.com...
> > > I checked the flags, and there is only char and integer fields. Any
> other
> > > ideas?

> > Do you have any triggers on your database end? If you have a trigger
that
> > changes the data, you can get this error also.

> > Natalie

Re:Record not found or changed by another user


Quote
"Chris Mount" <ch...@cookspest.com> wrote:

Hi Crhis,

I almost get crazy with that.
I think you sould have a look at a book of Eric Harmon,
That shows how to use cloned datasets.
Since i started to use cloned datasets i never had problem again,unfortunatelly i cant send you the routine because
im an employee,and my contract dont let me do it.
But its very used to understand its functionality.

Regards,
Marcello Dias

Quote
>I am using Windows XP, D7 with dbExpress to connect to a MySQL db on a linux
>server.
>I am using sqldataset -> datasetprovider -> clientdataset. I get the same
>problem using sqlquery component instead of sqldataset. I am trying to edit
>a record in a dataset and when ApplyUpdates(), this error appears. Inserting
>records works fine. There are no other users connected and the record is
>there. The same code works fine editing 6 other tables in same database. I
>am reading the values from a txt file and then updateing a dataset. The
>table has a fields with types of, smallint, int, and char. I can throw a
>dbgrid on the form and edit and click button to Post , ApplyUpdates(),
>Refresh . and works fine. Here is the basic code. I have also tried writing
>my on procedure for ApplyUpdates using event BeforeUpdateRecord. Still no
>luck. Instead of going through the dbgrid to change the values of fields, I
>previously tried working with just the clientdataset.

>        dtmdlHHUpdate.clntdtstBTubeLst.Open;

>         dbgrdBTube.DataSource.DataSet.RecNo:= StrToInt(btubeSeq);
>         dbgrdBTube.DataSource.DataSet.Edit;
>          tmpStr:= recFileNextField(line,3);
>          dbgrdBTube.DataSource.DataSet.FieldByName('BaitBar_ID')
>                .Value:= tmpStr;

>          dtmdlHHUpdate.clntdtstBTubeLst.Post;
>          dtmdlHHUpdate.clntdtstBTubeLst.ApplyUpdates(0);
>          dtmdlHHUpdate.clntdtstBTubeLst.Refresh;

>Any ideas, I would greatly appreciate.

>Chris

Re:Record not found or changed by another user


Quote
"Marcello Dias" <me...@hotmail.com> wrote in message

news:3e146378$1@newsgroups.borland.com...
Quote

> I think you sould have a look at a book of Eric Harmon,
> That shows how to use cloned datasets.
> Since i started to use cloned datasets i never had problem

again,unfortunatelly i cant send you the routine because

Quote
> im an employee,and my contract dont let me do it.
> But its very used to understand its functionality.

There is a very nice new article by Cary Jensen available on cloning
ClientDatasets at Borland's BDN site:
http://bdn.borland.com/article/0,1410,29416,00.html

--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
"Democracy, without that guarantee of liberty, is merely a method of
selecting tyrants." - Alan Nitikman

Other Threads