将excel逐个转为dbf,代码未运行成功,请问错在哪里了?能帮我指出来吗?谢谢!
程序代码:
SET DEFAULT TO ADDBS(JUSTPATH(SYS(16))) CLEAR CLOSE all SET SAFETY OFF iCount=ADIR(xlsList,"xls") FOR i=1 to iCount xlsName=xlsList(i,1) ff=JUSTSTEM(xlsName) cExcel =SYS(5)+SYS(2003)+"\"+ff+'.xls' cHDR = "YES" cSheet = "[sheet1$A2:d]" cSQL = "SELECT * FROM " + cSheet cConn = "Provider=Microsoft.ACE.OLEDB.12.0;"; + "Extended Properties='Excel 12.0;HDR="+cHDR+";IMEX=1';"; + "Data Source=" + cExcel oConn = CREATEOBJECT("ADODB.Connection") oConn.Open(cConn) oRs = CREATEOBJECT("ADODB.Recordset") oRs.Open(cSQL, oConn, 1, 3, 1) oRs.MoveFirst cstr = "" CREATE CURSOR tt (编号 I, 姓名 C(10), 联系电话 C(20), 部门 C(10)) cStr = oRs.GetString() STRTOFILE(cStr, "tmp.txt") SELECT tt APPEND FROM tmp.txt DELIMITED WITH TAB FOR 编号<>0 COPY TO &ff oRs.Close oConn.Close CLEAR ALL *RETURN ENDFOR
****以上代码未运行成功,请问错在哪里了?能帮我指出来吗?谢谢!
通讯录教导处.rar
(2.8 KB)
通讯录校长室.rar
(2.98 KB)
[此贴子已经被作者于2020-12-5 06:21编辑过]