select case Field1 when True then '正常' when False then '不正常' end as Field1 from atable
select case Field1 when True then '正常' when False then '不正常' end as Field1 from atable
procedure TForm_dxyckcx.TuxedoQuery1kxsxGetText(Sender: TField; var Text: String; DisplayText: Boolean); begin if sender.AsString='00' then text:='交纳代销押金'; if sender.AsString='01' then text:='交纳代收押金'; if sender.AsString='02' then text:='退还代销押金'; if sender.AsString='03' then text:='退还代收押金'; end;
应该这样, 呵呵, 忘了SQL Server 没有True和False了 :-)select case Field1 when 1 then '正常' when 0 then '不正常' end as Field1 from atable
应该这样, 呵呵, 忘了SQL Server 没有True和False了 :-)select case Field1 when 1 then '正常' when 0 then '不正常' end as Field1 from atable
select case tf when true then '正常' when false then '不正常' end as '新字段名' from '表名'
sql ser 里面没有TRUE,false,可以用一个charselect case tf when '0' then '正常' when '1' then '不正常' end as '新字段名' from '表名'
select case tf when '1' then '正常' when '0' then '不正常' end as '新字段名' from '表名'
比如有一个表: table1(id ,state ,name) 可以这样: select '正常' as Astate,name,id from table1 where state = true union select '不正常' as Astate,name,id from table1 where state = false
比如有一个表: table1(id ,state ,name) 可以这样: select '正常' as Astate,name,id from table1 where state = true union select '不正常' as Astate,name,id from table1 where state = false
比如有一个表: table1(id ,state ,name) 可以这样: select '正常' as Astate,name,id from table1 where state = true union select '不正常' as Astate,name,id from table1 where state = false
加计算字段 如 CListFieldOnCalcField 事件中加代码:With DataSet do begin if FieldByName('BooleanField').asBoolean then FieldByName('CListField').asString:='正常' else FieldByName('CListField').asString:='不正常'; end;
把Boolean型字段的OnGetText事件挂上如下代码就可以了procedure TForm1.YourFieldGetText(Sender: TField; var Text: String; DisplayText: Boolean); begin if Sender.AsBoolean then Text := '正常' else Text := '不正常'; end;
var Text: String; DisplayText: Boolean);
begin
if sender.AsString='00' then text:='交纳代销押金';
if sender.AsString='01' then text:='交纳代收押金';
if sender.AsString='02' then text:='退还代销押金';
if sender.AsString='03' then text:='退还代收押金';
end;
呵呵,
忘了SQL Server 没有True和False了 :-)select case Field1 when 1 then '正常' when 0 then '不正常' end as Field1 from atable
呵呵,
忘了SQL Server 没有True和False了 :-)select case Field1 when 1 then '正常' when 0 then '不正常' end as Field1 from atable
table1(id ,state ,name)
可以这样:
select '正常' as Astate,name,id from table1 where state = true
union
select '不正常' as Astate,name,id from table1 where state = false
table1(id ,state ,name)
可以这样:
select '正常' as Astate,name,id from table1 where state = true
union
select '不正常' as Astate,name,id from table1 where state = false
table1(id ,state ,name)
可以这样:
select '正常' as Astate,name,id from table1 where state = true
union
select '不正常' as Astate,name,id from table1 where state = false
1。我的表中有十几个字段都是boolean类型,都想让它显示为“正常”或“不正常”。
2。我用的是query控件+本地数据库文件(.db),各位朋友的方法,好像没办法用。
3。怎么办?
begin
if FieldByName('BooleanField').asBoolean then
FieldByName('CListField').asString:='正常'
else
FieldByName('CListField').asString:='不正常';
end;
DisplayText: Boolean);
begin
if Sender.AsBoolean then
Text := '正常'
else
Text := '不正常';
end;