Field DisplayLabel when assigning datasets, Question.

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
m227
Posts: 59
Joined: Mon 06 Aug 2007 12:41

Field DisplayLabel when assigning datasets, Question.

Post by m227 » Tue 09 Feb 2010 10:09

Hello once more.

I met following problem. When I assign one VT to another, the property of DisplayLabel isn't copied. So such code can produce different results:

Code: Select all

  V2 := TVirtualTable.Create(Self);
  V2.Assign(V1);
  ShowMessage( V1.FieldByName('anyfield').DisplayLabel );
  ShowMessage( V2.FieldByName('anyfield').DisplayLabel );
I presume it is some limitation of assigning or even it is obvious behaviour if only table data is copied. The question is, if there is a simple solution to copy DisplayLabel fields property instead of code:

Code: Select all

procedure CopyDisplayLabels(ds1, ds2: TDataSet);
var
  i: Integer;
begin
  for i := 0 to ds1.FieldCount - 1 do
    ds2.Fields[i].DisplayLabel := ds1.Fields[i].DisplayLabel
end;

AndreyZ

Post by AndreyZ » Fri 24 Sep 2010 06:56

Hello,

This is correct behaviour of the TVirtualTable component. You should copy the DisplayLabel property manually.

Post Reply