Hi friends.
I always get create XLS files but not XLSX files (it always
does one file in white, without the sheet).
THIS IS OK FOR XLS FILES:
cCon2 :=
"DBQ=D:\CCC_TGE\MAPA_TRANSA_TESA\MAPATMP1.XLS;Driver={Microsoft
Excel
Driver(*.xls)};ReadOnly=0;MaxScanRows=0;FirstRowHasNames=1"
oCon2 := SQLConnection():new()
IF !oCon2:driverConnect(nil, cCon2)
MsgBox("No se ha podido crear o conectar a
"MAPATMP1.XLSX")
oCon2:destroy()
RETURN
ELSE
oStmt := oCon2:NewStatement()
oStmt:DisplayErrors := .f.
oStmt:SQLString := 'DROP TABLE Hoja1'
oStmt:Execute()
oStmt:DisplayErrors := .t.
oStmt:SQLString := "CREATE TABLE Hoja1 (BCO TEXT,
VIA TEXT, EUR MONEY, TIPO TEXT, CUE INTEGER)"
oStmt:Execute()
oStmt:destroy()
oCon2:disconnect()
ENDIF
BUT NOT IS OK FOR XLSX FILES:
cCon2 :=
"DBQ=D:\CCC_TGE\MAPA_TRANSA_TESA\MAPATMP1.xlsx;Driver={Microsoft
Excel Driver (*.xls, *.xlsx, *.xlsm,
*.xlsb)};ReadOnly=0;MaxScanRows=0;FirstRowHasNames=1"
oCon2 := SQLConnection():new()
IF !oCon2:driverConnect(nil, cCon2)
MsgBox("No se ha podido crear o conectar a
"MAPATMP1.XLSX")
oCon2:destroy()
RETURN
ELSE
oStmt := oCon2:NewStatement()
oStmt:DisplayErrors := .f.
oStmt:SQLString := 'DROP TABLE Hoja1'
oStmt:Execute()
oStmt:DisplayErrors := .t.
oStmt:SQLString := "CREATE TABLE Hoja1 (BCO
TEXT, VIA TEXT, EUR MONEY, TIPO TEXT, CUE INTEGER)"
oStmt:Execute()
oStmt:destroy()
oCon2:disconnect()
ENDIF