Forum > Database

SQLDB, tfield.oldvalue shows value from current row not activerecord, bug?

(1/2) > >>

Soner:
I am using TDataset.ActiveRecord property.

When one field is not changed, then field.oldvalue shows the value from current row not from active record.
Only when the field value changed then it show right value.
Is this bug?

Look at my comments on screenshots.

(I had similar error on zeoscomponents.
http://zeoslib.sourceforge.net/viewtopic.php?f=28&t=84847
)

Soner:
this is example project:

Soner:
Is nobody using tfield.olvalue, tdataset.activerecord in his programs?

Soner:
Yes it is bug, It should show correct value or nothing.I reported it here
https://bugs.freepascal.org/view.php?id=34694

(PS: In example from above save-button does not work. It is half ported zeos example.)

valdir.marcos:

--- Quote from: Soner on December 10, 2018, 01:28:37 pm ---I am using TDataset.ActiveRecord property.

When one field is not changed, then field.oldvalue shows the value from current row not from active record.
Only when the field value changed then it show right value.
Is this bug?

Look at my comments on screenshots.

(I had similar error on zeoscomponents.
http://zeoslib.sourceforge.net/viewtopic.php?f=28&t=84847
)
--- End quote ---
I don't use TDataset.ActiveRecord, but a similar approach related to OldValue x NewValue could be:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormCreate(Sender: TObject);begin  IBConnection1.Connected := False;  IBConnection1.HostName := 'your server/3050';  IBConnection1.DatabaseName := 'your database';  IBConnection1.UserName := 'your user';  IBConnection1.Password := 'your password';  IBConnection1.CharSet := 'UTF8';  IBConnection1.Connected := True;   SQLQuery1.Close;  SQLQuery1.SQL.Text := 'Select Field2 From Table1 Where Field1 = 1;';  SQLQuery1.Open;  SQLQuery1.Edit;  SQLQuery1.FieldByName('Field2').AsString := 'new value';  ShowMessage('OldValue: ' + SQLQuery1.FieldByName('Field2').OldValue + LineEnding +              'NewValue: ' + SQLQuery1.FieldByName('Field2').NewValue);  SQLQuery1.CancelUpdates;  SQLQuery1.Cancel;  SQLTransaction1.Rollback ;  IBConnection1.Connected := False;end;

Navigation

[0] Message Index

[#] Next page

Go to full version