回复 4楼 sdta
完全正确,目前还是拿来主义,scan中间的for if repl还没理解,下次还是不会用,得好好消化
CLOSE DATABASES
USE 表1 ALIAS CHY1 IN 0
USE 表2 ALIAS chy2 IN 0
sELECT DISTINCT bmddm
FROM chy2 INTO ARRAY arr_bmddm
cmd = "CREATE CURSOR TJB (km c(8),zong I"
FOR i=1 TO ALEN(arr_bmddm)
cmd = cmd + "," + "N" + arr_bmddm[i] + " I"
ENDFOR
cmd = cmd + ")"
EXECSCRIPT(cmd)
APPEND FROM chy1&&
&提示chy1不存在,用原名表1才可以,上面有别名了,为什么提示错误
INDEX ON Km TAG Km
SELECT Chy2
SCAN
FOR ln = 1 TO ALINES(laKm, Xkkmzhmc, 5, "、")
IF SEEK(laKm[ln]+SPACE(8-LEN(laKm[ln])), "Tjb", "Km") = .T.
REPLACE Zong WITH Zong+1, ("N"+ALLTRIM(Chy2.Bmddm)) WITH EVALUATE("N"+ALLTRIM(Chy2.Bmddm)) + 1 IN Tjb
ENDIF
ENDFOR
ENDSCAN
SELECT Tjb
SET ORDER TO
DELETE TAG Km.CDX
[此贴子已经被作者于2024-5-16 22:34编辑过]