那在你连的数据源上处理(ClientDataSet或Query)对应A字段的onGetText事件中处理一下 procedure TForm1.ClientDataSet1AGetText(Sender: TField; var Text: String; DisplayText: Boolean); begin if Sender.Value := 'ABC' then Text := 'DEF'; end;
在A字段的OnGetText事件中写如下代码: if Sender.Value = 'ABC' then Text:='DEF' else Text := Sender.Value;
procedure TForm1.ADOQuery1AGetText(Sender: TField; var Text: String; DisplayText: Boolean); begin if adoquery1.RecordCount <= 0 then exit else if adoquery1.FieldByName(sender.FieldName).AsString = 'ABC' then text := 'DEF'; end;
procedure TForm1.ClientDataSet1AGetText(Sender: TField; var Text: String;
DisplayText: Boolean);
begin
if Sender.Value := 'ABC' then
Text := 'DEF';
end;
if Sender.Value = 'ABC' then
Text:='DEF'
else
Text := Sender.Value;
DisplayText: Boolean);
begin
if adoquery1.RecordCount <= 0 then
exit
else
if adoquery1.FieldByName(sender.FieldName).AsString = 'ABC' then
text := 'DEF';
end;
select (case a when 'abc' then 'def' else a end) as a from table