查询一个布尔型字段,在DBGrid中显出来时一般是false或是true。小弟想用‘是’或‘否’来代替显示。请各位高手指点!!!谢谢!!!!

解决方案 »

  1.   

    你在DGBrid中将这个字段重新命名就行了。
      

  2.   

    将字段添加为永久字段,在字段的ongettext事件中定义
      

  3.   

    select decode(blnField,false,'否',true,'是') 显示字段名 from table
      

  4.   

    如A表有两个字段,ID和bool字段,Bool为boolean类型
    select ID,Bool = case bool 
    when False then '否'
    when True then '是'
    end
    from A
      

  5.   

    楼上的 这个语句你在MDB数据库中能通过??
      

  6.   

    写DBGrid的DrawColumnCell事件。下面是一个金额(实数)字段格式化为羊字符后面为1,258.00的形式。可以根据它触类旁通。
    procedure TPersonalForm.DBGrid2DrawColumnCell(Sender: TObject;
      const Rect: TRect; DataCol: Integer; Column: TColumn;
      State: TGridDrawState);
    begin
      If gdSelected In State then
       begin
         DBGrid2.Canvas.Brush.Color := clMoneyGreen;
         DBGrid2.Canvas.Font.Color := clRed;
      end
      else
        DBGrid2.Canvas.Brush.Color := clWhite;
      DBGrid2.DefaultDrawColumnCell(Rect, DataCol, Column, State);
      If (Column.FieldName='Money') Or (Column.FieldName='Cash') Or (Column.FieldName='Price') Or (Column.FieldName='Leave') then
      begin
        With DBGrid2.Canvas do
        begin
          FillRect(Rect);
          TextRect(Rect,Rect.Left,Rect.Top,Format('%m',[Column.Field.AsFloat]));
        end;
      end;
    end;
      

  7.   

    同意   DelUser(探索者)