Page 1 of 1

Edit dosen't work

Posted: Wed 05 Apr 2006 14:48
by nucleide
Hello,

Since we install the DBEXpress MySQL, the edit fonction of the ClientDataset don't work.. We can Append a new record to the database but not edit.

I try a lot of combination, including changing field type and nothing seems working. The ReconcileError tell me that the record cannot be found or it might be take by someone else. (but it's not).

here is a little exemple of my code..

procedure TAppareils.DesactiverDB(var LeDataset: TClientDataset);
begin
if not LeDataset.Active then
LeDataset.Active := true;

if LeDataset.Locate('chr_Identificateur', FIdentificateur, Options) then;
begin
LeDataset.Edit;
LeDataset.FieldValues['chr_Actif'] := 'FALSE'; //false
// LeDataset.FieldByName('chr_Actif').AsString := 'FALSE';
// LeDataset.FieldByName('chr_Actif').Value := 'FALSE';
// LeDataset.post;
LeDataset.ApplyUpdates(-1);
end;
end;

My Connection is in 'MySQL Direct (Core Lab)' mode. MySQL version is mysql-4.1.18-win32.

As you can see the code is very simple.. it should work. Did the client dataset is the problem or another dbexpress component? I need help, i'm stuck here!

Thank you very much!
Luc

Posted: Fri 07 Apr 2006 15:14
by Antaeus
We have thoroughly tested this problem. It happens when there are records with zero values in DATETIME field in the table. When you edit and post such record without changing DATETIME field value and then call ApplyUpdates, the error is raised. To solve this problem make sure that you have Primary Key in your table and set DataSetProvider.UpdateMode to upWhereKeyOnly.

Edit dbexpress

Posted: Thu 20 Apr 2006 16:23
by nucleide
hi,

I try your way and nothing append too.

No matter what i done, the edit fuction not work...

The database seems not to be the problem, because i'm able to do it into an SQL query windows...

any other suggestion?

Using ADO

Posted: Thu 20 Apr 2006 17:27
by nucleide
Hi,

I use almost the same code with ado and it's working perfectly.

Edit ClientDataset finally work but....

Posted: Thu 20 Apr 2006 19:45
by nucleide
We finaly try a way to get a record update and find where the problem come from.

It seems that the ClientDataset and the Provider connection are break some how. Usualy we use this code with Mysql and MSSQL: The ClientDataset is attached to the Provider.

if CDSAppareils.Locate('CHR_IDENTIFICATEUR' UnAppareil.Identificateur, Options) then;
begin
CDSAppareils.Edit;
CDSAppareils.FieldByName('CHR_ACTIF').VALUE := FALSE;
CDSAppareils.ApplyUpdates(-1);
end;

And everything suppose to be fine.. But this time it dosen't work. Even if we use ConnectionTransaction. and Commit.

but, if we use this code it work :


if CDSAppareils.Locate('CHR_IDENTIFICATEUR', UnAppareil.Identificateur, Options) then;
begin
CDSAppareils.Edit;
CDSAppareils.FieldByName('CHR_ACTIF').VALUE := FALSE;
// CDSAppareils.ApplyUpdates(-1);
DSPAppareils.ApplyUpdates(CDSAppareils.Delta, -1, nCount);
end;

So, did CRLAB will apply a fix soon?

Posted: Fri 21 Apr 2006 14:42
by Antaeus
Our driver doesn't "know" what way do you use to apply updates: the first one or the second one. We don't think that the problem concerns our driver because it doesn't generate update queries. Please check if the problem persists using standard driver. If it doesn't, please send us (dbxmda*crlab*com) a complete small sample to demonstrate it, including script to create and fill table.

Also supply us following information
- Exact version of Delphi, C++ Builder or Kylix
- Exact version of dbxMda.
- Exact version of MySQL server.