var
 i,ii:integer;
begin
try
  ao1.Close;
  ao1.SQL.Clear;
  memo1.Lines.BeginUpdate;
  memo2.Lines.BeginUpdate;
  for i:=0 to memo1.Lines.Count -1 do
  for ii:=0 to memo1.Lines.Count -1 do
  ao1.SQL.Add('update character set zs_count='+quotedstr(memo2.Lines.Strings[i])+'where name='+quotedstr(memo1.Lines.Strings[ii]));
  ao1.ExecSQL;
finally
  application.MessageBox('完成','更新完毕!',0);
end;
end;

解决方案 »

  1.   

    var
     i,ii:integer;
    begin
    try  with ao1 do
       begin
         memo1.Lines.BeginUpdate;
         memo2.Lines.BeginUpdate;
         for i:=0 to memo1.Lines.Count -1 do
          begin
           for ii:=0 to memo2.Lines.Count -1 do  //memo2
             begin 
              Close;
              SQL.Clear; 
              SQL.Add('update character set zs_count='+quotedstr(memo2.Lines.Strings[i])  +'where name='+quotedstr(memo1.Lines.Strings[ii]));
              ExecSQL;
             end;
         end;
    finally
      application.MessageBox('完成','更新完毕!',0);
    end;
    end;
      

  2.   

    var
     i,ii:integer;
    begin
    try  with ao1 do
       begin
         memo1.Lines.BeginUpdate;
         memo2.Lines.BeginUpdate;
         for i:=0 to memo1.Lines.Count -1 do
          begin
           for ii:=0 to memo2.Lines.Count -1 do  //memo2
             begin 
              Close;
              SQL.Clear; 
              SQL.Add('update character set zs_count='+quotedstr(memo2.Lines.Strings[i])  +'where name='+quotedstr(memo1.Lines.Strings[ii]));
              ExecSQL;
             end;
         end;
       end;  //少了END;
    finally
      application.MessageBox('完成','更新完毕!',0);
    end;
    end;
      

  3.   

    注意i 和 ii 与memo1 和 memo2对应的值
      

  4.   

    你确定这样能行吗?更新的数据大概有600多条吧(两个memo的记录是相等的),一执行就无响应了,更新不了,有好的方法吗?谢谢!!