I'm trying to use FWHMaria and oMeter unsuccessfully.
If someone has created it before and can give me an orientation, I appreciate it.
- Code: Select all Expand view
#include "FiveWin.ch"
REQUEST DBFCDX
function Export()
local cHost := "127.0.0.1"
local cUser := "root"
local cPassword := ""
local oCn, oRs, nSecs, uRet, cTable, aTables
local cDb := "COMP04"
local oDlg, oMeterR
? "Connect to Server"
FWCONNECT oCn HOST cHost USER cUser PASSWORD cPassword
if oCn == nil
? "Connect Fail"
return nil
else
endif
if oCn != nil
? "Selecting database " + cDb, "Create if new"
if Empty( oCn:ListDbs( cDb ) )
oCn:CreateDB( cDb, "latin1" )
endif
oCn:SelectDB( cDb )
? "Connected to " + oCn:CurrentDB()
aTables := HB_dirScan( ".\", "*.dbf", "A" )
oRs := oCn:RowSet( aTables )
?oRs:LastRec()
for each cTable in aTables //{ "customer.dbf", "states.dbf" }
if ! oCn:TableExists( cFileNoExt( cTable[ 1 ] ) )
//ImportFromDBF( cDbfName, nil, nil, nil, nil, .F. ) // 5th param .F. suppresses creation of AutoInc field ID
nSecs := Seconds()
uRet := oCn:ImportFromDBF( cTable[ 1 ], nil, nil, nil, nil, .F. )
nSecs := Seconds() - nSecs
@ 2, 2 METER oMeter VAR nActual TOTAL 50 OF oDlg SIZE 135, 12
oMeterR:Set(oRs:RecCount())
endif
next
endif
? "IMPORTACION FINALIZADA"
oCn:Close()
return nil