我的处理意见:
1、这个问题最好交给服务器去做。
2、如果是ACCESS的数据库,那就交给ACCESS去做,在ACCESS里操作肯定比在DELPHI里处理要快。
3、如果是SQLSERVER那也交给服务器去做,用存储过程肯定更快。

解决方案 »

  1.   

    我用的是Access,可我想在程序中解决这一问题!
      

  2.   

    20多万条记录,逐条导出也不会慢的令人受不了吧,你最好作一个进度条,一条一条处理,这样就好看一点,其实,access导出20多万条记录也不会比delphi快到哪里,我估计也是一条一条作的。
      

  3.   

    是不是ADO补丁未打的缘故???
      

  4.   

    保存为XML:
    begin
    adotable1.SaveToFile('e:\Table.xml',pfXML);
    end;保存为格式化文本:
    var
      Stream:TStream;
      DataStr:string;
    begin
      DataStr := adotable1.Recordset.GetString(2,-1,';',#10#13,'<NULL>');
      Stream := TFileStream.Create('E:\Table.Dat',fmCreate);
      Stream.Write(DataStr[1],Length(DataStr));
      Stream.Free;
      DataStr := '';
    end;
    也可以用ADOQuery.Recordset.GetString Help(MSDN):GetString Method
          Returns the Recordset as a string.SyntaxSet Variant = recordset.GetString(StringFormat, NumRows, ColumnDelimiter, RowDelimiter, NullExpr)Return ValueReturns the Recordset as a string-valued Variant (BSTR).
    0A
    ParametersStringFormat   A StringFormatEnum value that specifies how the Recordset should be converted to a string. The RowDelimiter, ColumnDelimiter, and NullExpr parameters are used only with a StringFormat of adClipString.NumRows   Optional. The number of rows to be converted in the Recordset. If NumRows is not specified, or if it is greater than the total number of rows in the Recordset, then all the rows in the Recordset are converted.ColumnDelimiter   Optional. A delimiter used between columns, if specified, otherwise the TAB character.RowDelimiter   Optional. A delimiter used between rows, if specified, otherwise the CARRIAGE RETURN character.NullExpr   Optional. An expression used in place of a null value, if specified, otherwise the empty string.ResRow data, but no schema data, is saved to the string. Therefore, a Recordset cannot be reopened using this string.This method is equivalent to the RDO GetClipString method.0D