String Mysql, bfname, fname, name
Backup getfilesavename (" to ", fname, name, "db", "database files (*. Db), *. Db")
Bfname=trim (fname)
Mysql="BACKUP DATABASE TO 'fname" + + "
"The execute immediate: Mysql USING SQLCA;//use the SQL statement immediately perform a backup
If the sqlca. Sqlcode=0 then
Backup messagebox (" message ", "success", information! , OK!
The else
Messagebox (" message ", "backup failure", information! , OK!
End the if
I have already changed getfilesavename extensions to the "db", why the backup out extension or belt. 1?
Another, ask a backup of the file and the original content and structure of the database file should be the same? Is to replace the document on the back and in the original database file is no difference, isn't it?
Ask ace to give directions, thank!!!!!!
CodePudding user response:
The topCodePudding user response:
The topCodePudding user response:
Experts have a look at this piece of data recovery is a problem with the code? Why am I always failed restore?String fname, name, ls_dbfile ls_dbfile_tmp, ls_dir
Getfileopenname (" find ", fname, name, "1", "database backup files (*. 1), * 1")
String mysql, bfname gzname
Ulong SXZ=32 KB//SXZ for file attribute values, 32, said read-write
Boolean TMP
Bfname=trim (fname)
Bfname=left (bfname, len (bfname) - 2)
Ls_dir=GetCurrentdirectory ()
TMP ls_dbfile_tmp=ls_dir + '\' + ' '+' db '
Ls_dbfile=ls_dir + '\' + 'sfbr_test' + 'db'
Mysql="RESTORE the DATABASE '" + ls_dbfile_tmp +"' FROM '" + bfname + "' "
The execute immediate: Mysql USING SQLCA;
If the sqlca. Sqlcode & lt;> 0 then
Messagebox (" message ", "data recovery failure!!!!! "Information! , OK!
Return
End the if
Disconnect;//disconnect from the database
Gzname=ls_dbfile
SetFileAttributes (gzname, SXZ)//remove the read-only attribute
TMP=filedelete (gzname)//reply before deleting database
If TMP=false then
Messagebox (" message ", "backup failed!" And information! , OK!
Return
End the if
//will be a temporary database replication on the current database file
Bfname=ls_dbfile_tmp
Gzname=ls_dbfile
KB=filecopy (bfname gzname, true)
If KB=1 then
Messagebox (" message ", "database recovery success!" And information! , OK!
The else
Messagebox (" message ", "database recovery failed!" And information! , OK!
Return
End the if
Filedelete (ls_dbfile_tmp)//delete temporary database file
The connect.
CodePudding user response:
Ask advice, thank you master, look:)CodePudding user response:
I always recover data failure, followed by two exclamation point, so should be mysql="to RESTORE the DATABASE '" + ls_dbfile_tmp +"' FROM '" + bfname + "' "The execute immediate: Mysql USING SQLCA;
This part of the problem, which can help me with?
CodePudding user response:
Consult heheCodePudding user response:
The free player can teach? Really very urgent, ha ha, although know this is very bad, but I really need to solve this problem quickly...CodePudding user response:
The topCodePudding user response:
The topCodePudding user response:
What ah