如题

解决方案 »

  1.   

    在OnGetText & OnSetText里面写。
      

  2.   

    procedure TForm1.ADOTable1SEXGetText(Sender: TField; var Text: String;
      DisplayText: Boolean);
    begin
      if Sender.AsString='0' then
      Text:='男' else  Text:='女';
    end;
      

  3.   

    你再建一个表,名称:BitContent
    BitID  Content
      1      是
      0      否
    BitID与你的那个bit字段对应
    然后,在ADOQuery里新加一个LookUp字段,字段明:BitID,
    Keyfield-> BitID
    DataSet-> BitContent
    LookUp keys-> BitID(BitContent里面的)
    它的ResultField对应Content即可
      

  4.   

    使用MS Sql建立视图,在Sql中将Bit转换成"是"或"否"
      

  5.   

    或者
    在ADOQueryCalcFields事件里写
      if not Dataset.FieldByName('BitName').AsBoolean then
        Dataset.FieldByName('bitname').Value:='是';
      else
        Dataset.FieldByName('bitname').Value:='否';
      

  6.   

    在sql语句中用case:
    select field1,case field2 when 1 then 是,when 2 then 否 end,field3……
      

  7.   

    (Field As TBooleanField).DisplayValues :=Format('%s;%s ',['是','否']);
      

  8.   

    设计期写onsettext/onGetText事件可以
    新建一个计算字段也可以 dataset.CalcFields事件
      

  9.   

    OnGetText & OnSetText是哪个控件的事件啊?
      

  10.   

    同意~~
    >回复人: afei78223(阿飞) ( ) 信誉:101  2003-10-21 18:18:00  得分:0 
    >  (Field As TBooleanField).DisplayValues := Format('%s;%s ',['是','否']);
      
     
     VCL Reference
    TBooleanField.DisplayValuesTBooleanField See alsoControls how the Boolean field is translated to and from display format.property DisplayValues: string;DescriptionUse DisplayValues to specify strings the field uses to represent Boolean values. Use any pair of phrases, separated by a semicolon. For example, to have the True and False values correspond to the letters T and F, respectively, set DisplayValues as follows:Table1LogicalField.DisplayValues := 'T;F';Similarly, to set the values of True and False to the strings Yes and No, set DisplayValues to Table1LogicalField.DisplayValues := 'Yes;No';The string associated with True or False can be an empty string. To set the value for True to an empty string, set DisplayValues to a string that begins with a semicolon. For example, to associate False with the string Fail, and True with an empty string, set DisplayValues toTable1LogicalField.DisplayValues := ';Fail';To associate False with an empty string, set DisplayValues to the string for True, with no semicolon at all.The strings associated with True and False by DisplayValues appear in data-aware controls when they display the data for a Boolean field. If one of the strings is an empty string, Boolean values associated with that string appear blank in data-aware controls.These strings are also used when getting or setting the Boolean field抯 AsString property.
    //参考如下代码~~
    //也可以静态设置~~
    procedure TForm1.Table1AfterOpen(DataSet: TDataSet);
    begin
      TNumericField(DataSet.FieldByName('数值字段')).DisplayFormat := '"否";"是";"是"';
      TBooleanField(DataSet.FieldByName('逻辑字段')).DisplayValues := '是;否';
    end;
      

  11.   

    设数据集adotable的字段为静态字段:在方法中:
    procedure TForm1.ADOTable1SEXGetText(Sender: TField; var Text: String;
      DisplayText: Boolean);
    begin
      if Sender.Asinteger = 1 then
      Text:='是' else  Text:='否';
    end;
      

  12.   

    建议用Ehlib,我就是这么用的,很方便的.
      

  13.   

    select sexgb = case sex when 0 then '男' when 1 then '女' end
    from employee
      

  14.   

    在查询时可直接按以上的语句取值,则在查询到的内容里有此一项,可用DBGRID直接关联此项
    select sexgb = case sex when 0 then '男' when 1 then '女' end
    from employee
      

  15.   

    select '是否' = (case 字段名 when 0 then '否' when 1 then '是' end)
    from tablename
      

  16.   

    adoquery中的永久字段的displayvalues属性值设成 是,否 就行了,一句代码也不用
      

  17.   

    adoquery中的永久字段的displayvalues属性值设成 是,否 就行了,一句代码也不用
    更改: “是”与“否”中间是分号
      

  18.   

    adoquery中的永久字段的displayvalues属性值是什么啊?在哪儿设置啊?