大家好:
  现在我遇到这样一个问题,请高手帮忙解决!问题如下:
  我现在用FastReport (版本是 2.51)做报表。使用checkbox 控件。数据表中有一个字段,性别栏!字段结构是 nvarhchar(2).
  设计要达到的要求是:
  当字段值是“男”时,与其对应的CheckBox要打勾,当字段值是“女”时,与其对应的CheckBox要打勾.
  
  但我在运行报表的时候会出现这样的错误:
  An error occured during calclating[ADOInfo."lc10"]
  Report:fradoinfo
  Object:Check1
  Could not convert variant of type (OleStr) into type (Double).
已经想了半天了,也没有弄出来。请高手帮忙一下解决。
在此感谢了。

解决方案 »

  1.   

    呵呵,我自己搞定了。
    直接在frReport 的onBeforPrint 事件写以下代码就可以了。
    procedure Tfrmpalc.fradoinfoBeforePrint(Memo: TStringList; View: TfrView);
    begin
      inherited;
      if adoinfo.FieldByName('lc09').AsString ='已婚' then
      begin
        if  View.Name= 'Check6' then Memo.Text := 'True';
        if  View.Name= 'Check7' then Memo.Text := 'False';
      end;  if adoinfo.FieldByName('lc09').AsString ='未婚' then
      begin
        if  View.Name= 'Check6' then Memo.Text := 'False';
        if  View.Name= 'Check7' then Memo.Text := 'True';
      end;  if adoinfo.FieldByName('lc10').AsString ='男' then
      begin
        if  View.Name= 'Check4' then Memo.Text := 'True';
        if  View.Name= 'Check5' then Memo.Text := 'False';
      end;  if adoinfo.FieldByName('lc10').AsString ='女' then
      begin
        if  View.Name= 'Check4' then Memo.Text := 'False';
        if  View.Name= 'Check5' then Memo.Text := 'True';
      end;
    end;