其实最终目的不需要前面的基础
你所想要得我以前也干过,设置dataset.Fields.DisplayLabel 即可!!
i := 0;
while i< NewQuery.Fields.Count do
begin
if LowerCase(NewQuery.Fields.FieldName)= 'xh'then
NewQuery.Fields.DisplayLabel := '序号';
if LowerCase(NewQuery.Fields.FieldName)= 'cszh'then
NewQuery.Fields.DisplayLabel := '参数值';
if SXCSQuery.Locate('ZDYWM',LowerCase(NewQuery.Fields.FieldName),[]) then
NewQuery.Fields.DisplayLabel := SXCSQuery.FieldByName('ZDZWM').AsString
else begin
Prefix := Copy(LowerCase(NewQuery.Fields.FieldName), 1, 4);
FieldName := Copy(LowerCase(NewQuery.Fields.FieldName), 5, Length(NewQuery.Fields.FieldName));
if SXCSQuery.Locate('ZDYWM',LowerCase(FieldName),[]) then
begin
if Prefix = 'pre_' then
NewQuery.Fields.DisplayLabel := SXCSQuery.FieldByName('ZDZWM').AsString + '(前)'
else if Prefix = 'suf_' then
NewQuery.Fields.DisplayLabel := SXCSQuery.FieldByName('ZDZWM').AsString + '(后)';
end;
end;
i := i+1;
end;