BaldwinIV
BaldwinIV

Reputation: 147

CRUD form using TcxGrid not working after ApplyUpdates(0) using TClientDataSet

Im trying to create a CRUD form using a TcxGrid. My Components: TcxGrid -> TDataSource -> TClientDataSet -> TDataSetProvider -> TSQLQuery

Query is select * from tt_BraUCFormatoSUI, Provider has UpdateMode=upWhereAll, ClientDataset has 2 fields: ID_UC and ID_SUI.

Running the .exe and trying to create, edit or delete any row, the row changes in the form if edit, or disappear if delete but this change is not evident in database.

In debug mode When executing ApplyUpdates(0) in the AfterDelete event (when I click on the minus button of the navigator), it shows:

First chance exception at $75B1B512. Exception class TDBXError with message 'ORA-01722: invalid number'. Process Project3.exe (12052)

First chance exception at $75B1B512. Exception class EDatabaseError with message 'Unable to find record. No key specified'. Process Project3.exe (12052)

This is how my form looks like:

enter image description here

And this is the code, it's quite simple, but I don't know if I have been missing something

procedure TForm3.cdBraUCFormatoSUIAfterDelete(DataSet: TDataSet);
begin
 cdBraUCFormatoSUI.ApplyUpdates(0);
 end;

procedure TForm3.cdBraUCFormatoSUIAfterPost(DataSet: TDataSet);
begin
 cdBraUCFormatoSUI.ApplyUpdates(0);
end;

procedure TForm3.FormCreate(Sender: TObject);
begin
 cdBraUCFormatoSUI.Open;
end;

ADITIONAL INFO: This table only has one restriction, ID_UC and ID_SUI can't have duplicates i.e (ID_UC:1 and ID_SUI: 2 twice is not able)

Upvotes: 0

Views: 163

Answers (0)

Related Questions