我曾经这样:
query.sql.add('backup database 数据库 to disk="'+getcurrentdir+EDIT.text+'"');
但是抱错
以前好象在CSDN上有过类是问题
请问那为大哥能告诉我怎么做啊
(在线等代,ADO和BDE的都可以)
query.sql.add('backup database 数据库 to disk="'+getcurrentdir+EDIT.text+'"');
但是抱错
以前好象在CSDN上有过类是问题
请问那为大哥能告诉我怎么做啊
(在线等代,ADO和BDE的都可以)
Backup DataBase 数据库名 to disk = 备份的磁盘位置('c:\test.bak')
恢复数据库
restore database 数据库名 from disk= 恢复的磁盘位置('c:\test.bak')
Query.SQL.ADD('Backup DataBase 数据库名 to disk = 备份的磁盘位置('c:\test.bak')');
Query.ExecSQL
query.sql.add('backup database 数据库 to disk='''+getcurrentdir+EDIT.text+'''');
windwather()
firetoucher(风焱)
正确
try
backupString := 'BACKUP DATABASE [Paper] TO DISK = N'''+edit1.Text+''' WITH INIT , NOUNLOAD , NAME = N''Paper 备份'', NOSKIP , STATS = 10, NOFORMAT';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(backupString);
ADOQuery1.Prepared;
adoquery1.ExecSQL;
application.MessageBox('备份成功。','提示',0);
except
application.MessageBox('备份出错!请重新备份数据。','出错',0);
end;
还原如下:
if opendialog1.Execute then
begin
try
adoquery1.Close();
adoquery1.SQL.Clear;
adoquery1.SQL.Add('use master');
adoquery1.Prepared;
adoquery1.ExecSQL;
restorestring := 'RESTORE DATABASE [Paper] FROM DISK = N'''+opendialog1.FileName+''' WITH FILE = 1, NOUNLOAD , STATS = 10, REPLACE,RECOVERY';
self.ADOCommand1.CommandText := restoreString;
adocommand1.Execute;
application.MessageBox('还原数据成功','提示',0); adoquery1.Close();
adoquery1.SQL.Clear;
adoquery1.SQL.Add('use paper');
adoquery1.Prepared;
adoquery1.ExecSQL;
except
application.MessageBox('还原数据出错!请重新还原,并停止一切的数据操作!','提示',0);
end;
end;