locate 命令示例

在下列示例中,定位德国顾客的记录,然后显示总数。

close databases
open database (home( ) + 'samples\data\testdata')
use customer && 打开 customer 表
set talk off

store 0 to gncount
locate for alltrim(upper(customer.country)) = 'germany' 
do while found( )
gncount = gncount + 1
? company
continue
enddo

? 'total companies germany: '+ ltrim(str(gncount))