用select 好象实现不了,但可以在dataset.fields里增加字段来实现显示

解决方案 »

  1.   

    select case Field1 when True then '正常' when False then '不正常' end as Field1 from atable
      

  2.   

    select case Field1 when True then '正常' when False then '不正常' end as Field1 from atable
      

  3.   

    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;
      

  4.   

    应该这样,
    呵呵,
    忘了SQL Server 没有True和False了 :-)select case Field1 when 1 then '正常' when 0 then '不正常' end as Field1 from atable
      

  5.   

    应该这样,
    呵呵,
    忘了SQL Server 没有True和False了 :-)select case Field1 when 1 then '正常' when 0 then '不正常' end as Field1 from atable
      

  6.   

    select case tf when true then '正常' when false then '不正常' end  as '新字段名'  from '表名'
      

  7.   

    sql ser 里面没有TRUE,false,可以用一个charselect case tf when '0' then '正常' when '1' then '不正常' end  as '新字段名'  from '表名'
      

  8.   

    select case tf when '1' then '正常' when '0' then '不正常' end  as '新字段名'  from '表名'
      

  9.   

    比如有一个表:
    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
      

  10.   

    比如有一个表:
    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
      

  11.   

    比如有一个表:
    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
      

  12.   

    我没办法乐:
    1。我的表中有十几个字段都是boolean类型,都想让它显示为“正常”或“不正常”。
    2。我用的是query控件+本地数据库文件(.db),各位朋友的方法,好像没办法用。
    3。怎么办?
      

  13.   

    加计算字段 如 CListFieldOnCalcField 事件中加代码:With DataSet do 
    begin
         if FieldByName('BooleanField').asBoolean then 
            FieldByName('CListField').asString:='正常'
         else
            FieldByName('CListField').asString:='不正常';
    end;
      

  14.   

    把Boolean型字段的OnGetText事件挂上如下代码就可以了procedure TForm1.YourFieldGetText(Sender: TField; var Text: String;
      DisplayText: Boolean);
    begin
      if Sender.AsBoolean then
        Text := '正常'
      else
        Text := '不正常';
    end;