寻找不止一次出现的表达式

Seeking for more than one occurrence of an expression

如何在 foxpro 中搜索多个基于索引键的匹配项?我想将 table dl 中的 chosen 字段更改为 T ctwctw 中存在 subdir 字段匹配的所有行=12=] tables。将对 ctw 内的所有行重复此匹配搜索。 dl 中具有相等 subdir 值的记录未按顺序排列。

目前,在将 chosen 更改为 T 后,代码在第 17 行 do while not eof() 嵌套循环中退出并显示 遇到文件结尾 消息dl 记录仅匹配 ctw 的第一个 subdir 值。

select 0
use ctw

select 0
use dl
index on subdir to subdir.idx 

select ctw

do while .not. eof() 

    select dl 
    seek ctw -> subdir

    if found()
        do while not eof() 
            replace chosen with .t. for ctw -> subdir = dl -> subdir
            skip
        enddo
    endif

    select ctw 
    skip 
enddo

你的编码风格很老。您收到错误是因为:

将...替换为...

遍历整个table,将记录指针留在底部。然后跳过会导致错误。

您的代码也很难阅读和遵循。我会修改为:

Update dl Set chosen = .T. Where subdir In (Select subdir From ctw)