FoxPro 9.0通过表循环

时间:2012-12-14 06:43:59

标签: foxpro

是否可以遍历表并从每行检索值

=================
Contracts.dbf
=================
P01
C04
CH45
T31


counter = 1
Do While 1 < 4
   SomethingSomethingSomething
counter = counter + 1
ENDDO

因此当counter = 1时,循环返回P01,counter = 2返回C04,依此类推。

2 个答案:

答案 0 :(得分:2)

SELECT Contracts

SCAN

    m.Counter = 1
    m.Something = ""

    DO WHILE m.Counter <= FCOUNT() 
        m.Something = EVAL(FIELD(m.Counter))
        m.Counter = m.Counter +1
    ENDDO

ENDSCAN

答案 1 :(得分:1)

试试这个:

SELECT contracts
SCAN
    x = contracts.fieldname1
    MESSAGEBOX("Value -> " + x)
ENDSCAN