我需要将ORACLE数据库的执行结果
select AAA,BBB,CCC from user1_info
union
select AAA,BBB,CCC from user2_info以如下格式
AAA,BBB,CCC输出到文本文件中,请问如何执行?(可能有查询出上万条记录)

解决方案 »

  1.   

    用dxdbgrid控件,直接用它的输出方法就可以了
      

  2.   

    楼上的说的不清不楚的.
          BomList:=Tstringlist.Create;
          fieldslist:=Tstringlist.Create;
          Recordstr:='';
          with DM do
          begin
            Linkquery.GetFieldNames(fieldslist);
            for I := 0 to fieldslist.Count-2 do    // Iterate
            begin
              Recordstr:=Recordstr+'"'+fieldslist[i]+'",';
            end;    // for
            Recordstr:=Recordstr+'"'+fieldslist[fieldslist.count-1]+'"';
            BOMList.Add(Recordstr);
            Linkquery.First;
            while not Linkquery.Eof do
            begin
              Recordstr:='';
              for I := 0 to Linkquery.FieldCount-2 do    // Iterate
              begin
                Recordstr:=Recordstr+'"'+Linkquery.Fields[i].AsString+'",';
              end;    // for
              Recordstr:=Recordstr+'"'+Linkquery.Fields[Linkquery.FieldCount-1].AsString+'"';
              BOMList.Add(Recordstr);
              Linkquery.Next;
            end;    // while
          end;    // with
          BOMList.SaveToFile(exportdialog.FileName);
          BOMList.Free;
          fieldslist.Free;