各位大虾帮帮忙,字段得从DBGrid里取

解决方案 »

  1.   

    其实数据还是从dataset里面去的,我这里有个用adotable连dbgrid,并把内容写入txt文件的例子:
    procedure TForm1.Button1Click(Sender: TObject);
    var f:textfile;
        cc:integer;
        filename:string;
    begin
      adotable1.Open;
      filename:=ExtractFilePath(Application.ExeName)+'logs\'+datetostr(date)+'.txt';
      //showmessage(ExtractFilePath(Application.ExeName));
      assignFile(f,filename);
      rewrite(f);
      //adotable1.field
      with adotable1 do
      begin
        disablecontrols;
        first;
        while not eof do
        begin
         for cc:=0 to fieldcount-1 do
         write(f,fields[cc].asstring);
         next;
        end;
        writeln(f,'');
        first;
        enablecontrols;
      end;
      closefile(f);
    end;
      

  2.   

    可是我是连到execl文件的  用的是adodateset控件
    好象不能用你的方法吧
      

  3.   

    Anylib推出新版本,自由界面和报表的完美组合!
    http://www.anylib.com