I have a TIBCQuery with a few TFields at Designtime, not all of the result.
Now I set Property "FieldOptions.AutoCreateMode" (comes from TDataset) to acCombineAlways.
This didn't work, because in "TMemDataSet.InternalOpen" the method "CreateFields" is only called "if not (lcPersistent in Fields.LifeCycles)".
I removed that line and my plan works, it adds missing tfields. Is there a option that it works without removing the line "if not (lcPersistent in Fields.LifeCycles) then"?
An I have a Problem in the follow up:
I have my TField and can write data to it. then i call the post-method and it writes no data to the field in the database.
Then I make a edit and post again, it writes the data to the database. What do i wrong?
Code: Select all
IBCConnection1.Open;
IBCQuery1.ParamByName('id').AsInteger := 1;
IBCQuery1.Open;
IBCQuery1.Edit;
IBCQuery1.FieldByName('name').AsString := 'asdf 1 ' + IntToStr(Random(1000));
IBCQuery1.Post; // name has not the value in the DB
IBCQuery1.Close;
IBCQuery1.Open;
IBCQuery1.Edit;
IBCQuery1.FieldByName('name').AsString := 'asdf 2 ' + IntToStr(Random(4000));
IBCQuery1.Post; // name has the value in the DB
IBCQuery1.Close;
IBCConnection1.Close;
Code: Select all
Connect: VARIO@localhost/3050
Start:
-------------------------
select benutzer, name from ben
where id = :id
order by id
:id(INTEGER)=1
-------------------------
UPDATE BEN
SET
BENUTZER = ?
WHERE
BENUTZER = ?
:BENUTZER(CHAR[3],IN)='NEU'
:Old_BENUTZER(CHAR[3],IN)='NEU'
-------------------------
CommitRetaining:
-------------------------
select benutzer, name from ben
where id = :id
order by id
:id(INTEGER)=1
-------------------------
UPDATE BEN
SET
BENUTZER = ?, NAME = ?
WHERE
BENUTZER = ?
:BENUTZER(CHAR[3],IN)='NEU'
:NAME(VARCHAR[11],IN)='asdf 2 1305'
:Old_BENUTZER(CHAR[3],IN)='NEU'
-------------------------
CommitRetaining:
Commit:
Disconnect: VARIO@localhost/3050
IBDAC 5.7.24 - Delphi 10 Seattle
I hope that was comprehensible

Regards, Jan