如何将 课务分工20190101.txt文件写入jsrkb1.dbf中
现有 课务分工20190101.txt文件和jsrkb1.dbf(空表),如何将 课务分工20190101.txt文件写入jsrkb1.dbf中,请高手赐教,万分感谢!!!
课务分工20190101.zip
(2.82 KB)
CLOSE DATABASES USE jsrkb1 ZAP INDEX ON nj + bj TAG njbj lcStr = FILETOSTR("课务分工20190101.txt") ALINES(laStr, lcStr, 4 + 1) FOR ln1 = 1 TO ALEN(laStr, 1) FOR ln2 = 3 TO ALINES(la, laStr[ln1], 4 + 1, ",", CHR(9)) - 1 lcnj = STREXTRACT(la[ln2], "", "(") lcbj = "(" + STREXTRACT(la[ln2], "(", "班") + "班" lckc = STREXTRACT(la[ln2],"班", "") IF SEEK(lcnj + lcbj, "jsrkb1") = .T. REPLACE (lckc) WITH la[2] ELSE APPEND BLANK REPLACE nj WITH lcnj, bj WITH lcbj, (lckc) WITH la[2] ENDIF ENDFOR ENDFOR SELECT *, 0 xh FROM jsrkb1 INTO CURSOR lsb READWRITE REPLACE xh WITH ICASE(LEFT(nj, 2) == "一", 1,LEFT(nj, 2) == "二", 2, LEFT(nj, 2) == "三", 3, LEFT(nj, 2) == "四", 4,LEFT(nj, 2) == "五", 5, 6) ALL SELECT * FROM lsb ORDER BY xh, nj, bj