var TextList:Tstringlist; LineStr:string; LineNo:integer; begin Textlist:=Tstringlist.create; if opendialog1.Execute then begin Textlist.LoadFromFile(opendialog1.filename); LineNo:=0; while LineNo<TextList.Count do begin LineStr:=Textlist[LineNo]; Table1.InsertRecord(Copy(LineStr,1,4),Copy(LineStr,5,10),Copy(LineStr,16,10)); Inc(LineNo); end; end; TextList.Free; end; 试试吧.
用BDE的话也可以用BACTHMOVE
要是结构不同可以用缓存更新模式,一条一条写进缓存模式的query中,然后一起提交,会快一点
我用的是bde.考虑使用bde来处理.使用batchmove如何加快速度?
用sqlloader不就得了
TextList:Tstringlist;
LineStr:string;
LineNo:integer;
begin
Textlist:=Tstringlist.create;
if opendialog1.Execute then
begin
Textlist.LoadFromFile(opendialog1.filename);
LineNo:=0;
while LineNo<TextList.Count do
begin
LineStr:=Textlist[LineNo];
Table1.InsertRecord(Copy(LineStr,1,4),Copy(LineStr,5,10),Copy(LineStr,16,10));
Inc(LineNo);
end;
end;
TextList.Free;
end;
试试吧.
1.首先要删掉索引,如果有索引的话速度会很慢2.使用SQLLoader从文本中导入最合适,速度会很快。
这个是我程序中的一部分,同时,也不可能删除索引.
2。如果数据量太大(我做过1000万以上的),建议封装SQL LOADER,速度奇快;
3。删掉索引,增大表空间,尤其注意回滚段,如果数据量大,回滚段会越来越大,速度会越来越慢。要不每插入1%提交一次;
4。一次性的插入数据到数据库,可采用链表结构实现,但DELPHI中实现比较麻烦,我用PRO C实现就非常方便,速度也很快。以上经验,或许有用。
这个是我程序中的一部分,同时,也不可能删除索引.
这个是我程序中的一部分,同时,也不可能删除索引.