CLOSE DATABASES
USE A10 IN 0
FOR I=1 TO ADIR(ADBF,"*.DBF")
APPEND FROM (ADBF[I,1])
ENDFOR
BROWSE
USE A10 IN 0
FOR I=1 TO ADIR(ADBF,"*.DBF")
APPEND FROM (ADBF[I,1])
ENDFOR
BROWSE
坚守VFP最后的阵地
clear CLOSE DATABASES ALL SET COLLATE TO "MACHINE" CREATE CURSOR 合并表 (工号 N(4,0), 姓名 C(8), 部门 C(20), 总量 N(10,2)) FOR i=1 TO ADIR(adbf,"*.dbf") USE (adbf[i,1]) IN 0 ALIAS tt *!* 第一步:检查表中的平衡关系 SELECT tt cField="" FOR ii=4 TO FCOUNT()-1 cField=cField+IIF(EMPTY(cField),"","+")+FIELD(ii) ENDFOR SELECT * FROM tt WHERE 总量!=&cField INTO CURSOR TTT * 平衡关系发生错误时弹出浏览窗口,显示错误记录 IF _TALLY>0 BROWSE FOR 总量!=&cField TITLE adbf[i,1]+" 平衡关系发生错误,请手工修改数据!" USE IN ttt ENDIF *!* 第二步:合并表中增加字段 FOR ii=4 TO AFIELDS(azdm,"tt") IF TYPE("合并表."+azdm[ii,1])=="U" cf=azdm[ii,1]+" "+azdm[ii,2]+"("+TRANSFORM(azdm[ii,3])+","+TRANSFORM(azdm[ii,4])+")" ALTER TABLE 合并表 ADD &cf ENDIF ENDFOR *!* 第三步:向 合并表 中添加数据 SELECT 合并表 INDEX ON 工号 TAG PX SELECT tt SET RELATION TO 工号 INTO 合并表 SCAN IF NOT FOUND("合并表") INSERT INTO 合并表 (工号,姓名,部门) VALUES (tt.工号,tt.姓名,tt.部门) ENDIF FOR ii=4 TO FCOUNT("tt") nValue=EVALUATE(FIELD(ii,"tt")) REPLACE (FIELD(ii,"tt")) WITH EVALUATE("合并表."+FIELD(ii,"tt"))+nValue IN 合并表 ENDFOR ENDSCAN USE IN tt ENDFOR SELECT 合并表 LOCATE BROWSE