大概20000多条数据写入csv格式文件速度太慢,怎么办?
用以下循环写入,strGen 是AnsiString,Query是ADODataSet
for ( int i=0; i < Query->RecordCount;i++)
{
for(int j=0;j<Query->FieldCount;j++)
{
strGen=strGen + Query->Fields->Fields[j]->AsString + ",";
}
Query->Next();
Application->ProcessMessages();
//SBar1->SimpleText="写入第 " + IntToStr(i) + " 条数据";
strGen=strGen + "\r\n" ;
}
写1000多条数据用了9秒,写20000多条数据时等了7分钟还没完,等不及将进程杀掉了,各位有什么好的办法么?