I use this code below:
- Code: Select all Expand view
METHOD RunDatabaseBackup() CLASS TWinCraneErp
LOCAL fp
LOCAL chost := GetServer()
LOCAL names := 'utf8'
LOCAL nport := 3306
LOCAL db := GetLoginDataBase()
LOCAL cDriver := CurDrive()
LOCAL cDriverDir := GetCurDir()
LOCAL cdir := cDriverDir + "\BackUpData\" // cDriver + ":\" + cDriverDir + "\BackUpData\"
LOCAL cfile := 'BackupDatabase.sql'
fp:=FCREATE("bak.bat")
WRITE(fp,"@ECHO OFF")
FWRITE(fp,CRLF+"mysqldump.exe --host "+AllTrim(chost)+" --default-character-set="+names+" --port="+cvaltochar(nport)+" -u root -p1234 "+AllTrim(db)+" > "+alltrim(cdir)+iif(right(alltrim(cdir),1)=="\","","\")+alltrim(cFile))
FCLOSE(fp)
WaitRun("call bak.bat",0)
RETURN NIL
WaitRun("call bak.bat",0) => run it not work. If I windows file work fine.
Any solution be welcome!!