你是用那个foxpro版本?用seek 会比用locate 更好更快
e.g.
if seek(...)
   seek ...
endif活用索引吧,  不然你每次locate後, 都要go top, 重头再scan全表了.

解决方案 »

  1.   

    看这样改一下如何:
    select a
    go top
    do while !eof()
         select b
         locate for allt(gsjb0001)==allt(a.gsjb0001)    &&有索引用seek
         if found()
            update gkzx set gsjb0041=a.gsjb0041 where gsjb0001=a.gsjb0041 overwrite
         endif
         select a
         skip
    enddo
      

  2.   

    改成这样吧
    select a
    use lsygnew
    count to n    &&这时表lsygnew已到文件尾了所以在下面加上一句
    go top
    select b
    use gkzx
    for i=1 to n
    select a
    dm=gsjb0001
    select b
    locate for gsjb0001=dm
    if found()
    update gkzx set gsjb0041=a.gsjb0041 where  gsjb0001=dm overwrite
    else
    endif
    go top
    select a
             if !eof()
                skip
              else
                 exit
             endif
    endfor