begin
   if fileexists('c:\temp\d14064.txt') then begin
   FlatButton2.Enabled:=false;
   Screen.Cursor:=CrhourGlass;
//   adotable1.DatabaseName:='c:\temp';
   adotable1.Connection:=ADOConnection1;
   adotable1.TableName:='ckdb';
   adotable1.Active:=true;
   adotable1.Edit;
   lines:=Tstringlist.Create;
   lines.LoadFromFile('c:\temp\d14064.txt');
   for i:=0 to pred(lines.Count-1) do begin
   adotable1.Append;
   s:=lines[i];
   s2:=copy(s,10,16);
   adotable1.FieldByName('lnkh').Value:=s2;
   s2:=copy(s,40,12);
   adotable1.FieldByName('cksj').Value:=s2;
   s2:=copy(s,88,10);
   adotable1.FieldByName('tzsj').Value:=s2;
   try
   adotable1.Post;
   except
//   on EDBEngineError do begin
//   on EDBEngineError do begin
//   messagebox(handle,'写数据库失败.','失败',0);
//   adotable1.Cancel
   adotable1.Cancel;
//   adotable1.Edit;
   continue;
//   end;
   end;
   end;
   lines.Free;
   showmessage('装入文本文件成功!');
   end else  begin
   showmessage('没有找到可转换的文本文件');
   end;
   Screen.Cursor:=Crdefault;
   adotable1.Active:=false;
   end;
****************************
数据是插入到表里面了,就是为什么鼠标总是:Screen.Cursor:=CrhourGlass
并且没有显示 '装入文本文件成功!' 
帮我!

解决方案 »

  1.   

    用adotable1.updatebatch;
    替换
    adotable1.Post;
      

  2.   

    光是看代码的话不知道你哪里错了,要不你把代码发到我的MAIL中吧,我帮你测试一下,MAIL会在短消息中给你!
      

  3.   

    最后发现写的是有点乱,没有错误,但是时间太长lines.Count的有1万多。
    整个过程有5分钟,怎么解决这个问题。
      

  4.   

    不要用ADOTABLE 用ADOQUERY解决,写SQL语句