这个很简单的,首先通过query把数据取出,然后按照你的要求从头到尾做一次轮训,取出各字段的值。while not query.eof do
begin
  for I := 0 to query.fields.count - 1 do
  begin
    str := ‘,’+ query.fields[I].asstring;
  end;
end;每完成一条记录就忘文本里写一行
或者用stringlist把所有的记录先保存起来,最后一次写到文本文件中

解决方案 »

  1.   

    stringlist的使用:var
      strL:TstringList;
      i:  Integer;
    begin
    strL:=TstringList.Create;//创建一个stringlist
    for i:=0 to 9 do  begin
       strL[i]:=IntToString(i);
       showmessage(strL[i]);
    end;             //使用一个0-9的Stringlist
    end;
      

  2.   

    自己建立文本型的数据库(bde和odbc都行),然后进行数据库表之间的拷贝!
      

  3.   

     assignfile(f,filename);     while not main.table1.Eof do
           begin       s:='0937';
           for i:=1 to main.table1.fields.count-1 do
             begin
              s:=s+','+main.table1.Fields[i].asstring;
             end;
           rewrite(f);
           writeln(f,s);
           end;
        closefile(f);为什么只写入一行,而且不能结束,怎样才能将整个表写到文本中去?
      

  4.   

    用TADODataSet吧,直接就有SaveToFile方法
      

  5.   

    也可以通过word的接口,delphi自带了一个关于调用word的程序例子,你改以下就可以建立word文件,将你的数据库内容写入word文档
      

  6.   

    我的ado无法连接数据库(informix);
      

  7.   

    assignfile(f,filename);
    rewrite(f);
    ~~~~~~~~~~~
        while not main.table1.Eof do
          begin      s:='0937';
          for i:=1 to main.table1.fields.count-1 do
            begin
              s:=s+','+main.table1.Fields[i].asstring;
            end;
          
          writeln(f,s);
          end;
        closefile(f);应该这样吧!