Home > database >  Questions about the data backup
Questions about the data backup

Time:10-05


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//global external functions provides

The FUNCTION Boolean SetCurrentDirectory (ref string lpPathName) Library "KERNEL32. DLL" Alias for "SetCurrentDirectoryA
"
//clicked

String docname='GZGL. Bak, named

An integer value

Value=https://bbs.csdn.net/topics/GetFileSaveName (" please enter the backup file name ", & amp;
Docname, named, "BAK", & amp;
"Backup Files (*. BAK), *. BAK")

IF the value=https://bbs.csdn.net/topics/1 THEN
Sle_PATH. Text=docname
SetCurrentDirectory (gs_path)
End the if
//backup database
String backup
STRING pathstring
Pathstring=sle_PATH. TEXT
Messagebox (' information system ', 'please close all the Windows first! ', the Exclamation!)
If pathstring="' then
Messagebox (" prompt ", "please enter the backup database name!" )
Return
End the if

//Disconnect USING sqlca;
//Profile master
The SQLCA. DBMS="ODBC"
The SQLCA. The AutoCommit=False
The SQLCA. DBParm="ConnectString='DSN=master; UID=; The PWD='
"
Connect using the sqlca;
Backup="backup database GZGL to disk=" + "'" + pathstring + "'";
The EXECUTE IMMEDIATE: backup;
If the sqlca. Sqlcode=0 then
Messagebox (' congratulations', 'database backup success! ')
The else
Messagebox (" aiya! "and" wrong + "+ sqlca. Sqlerrtext)
End the if
//disconnect;
Return

Can't imagine why appear this situation, and I'm using the ASA is for this reason!!!!!!

Wrong + sqlstate=37000,

[sysbase] [odbc driver] [the adaptive server anywhere] syntax error or access violation: near 'GZGL' in the database to disk='d: \ [GZGL]... '

CodePudding user response:

Backup="backup database GZGL to disk=" + "'" + pathstring + "'";
///////////////////////////////////

Messagebox (" tip ", backup)

Check this sentence content

Mandatory self-censorship, I seem to remember the ASA should be used: backup database to "c: \ aa
"Don't have to add data name

CodePudding user response:

Write wrong, should use single quotes

Backup the database directory 'c. \ 'bb'

It will under the C drive, if BB this directory exists, the direct backup, if there is no BB directory, create again after the backup

CodePudding user response:

Lz want?

CodePudding user response:

Support her Lord, collection
  • Related