Hi
Is there a property that is changed or some event that is fired when any value in the stored rows in tunitable object is changed?
Thank in advance.
TUniTable record change (UniDAC 4.3.8)
-
AndreyZ
Re: TUniTable record change (UniDAC 4.3.8)
Hello,
You can use the Modified property to determine if a record was changed. Here is a code example:For more information about the Modified property, please refer to the Delphi documentation.
You can use the Modified property to determine if a record was changed. Here is a code example:
Code: Select all
UniTable1.Open;
ShowMessage(BoolToStr(UniTable1.Modified, True)); // shows False as there are no changes
UniTable1.Edit;
ShowMessage(BoolToStr(UniTable1.Modified, True)); // still shows False as there are no changes
UniTable1.FieldByName('field1').AsString := 'newvalue';
ShowMessage(BoolToStr(UniTable1.Modified, True)); // shows True as the field1 field was changedRe: TUniTable record change (UniDAC 4.3.8)
Hi
With this code :
should be so?
Is there other property that is changed or some event that is fired when insert a record?
Thanks
With this code :
Code: Select all
UniTable1.InsertRecord([KeyNum, 'Hello'])
ShowMessage(BoolToStr(UniTable1.Modified, True)); // shows False
Is there other property that is changed or some event that is fired when insert a record?
Thanks
-
AndreyZ
Re: TUniTable record change (UniDAC 4.3.8)
It is a correct behaviour. The InsertRecord method inserts a new record and immediately posts it. That is why, the Modified property shows False.
If you want to determine that a new record was added, you can use the AfterInsert event. Here is a code example:
If you want to determine that a new record was added, you can use the AfterInsert event. Here is a code example:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
begin
UniQuery1.SQL.Text := 'select * from tablename';
UniQuery1.Open;
UniQuery1.InsertRecord([values]);
end;
procedure TForm1.UniQuery1AfterInsert(DataSet: TDataSet);
begin
ShowMessage('A new record is added');
end;