注册 登录
编程论坛 Delphi论坛

用Delphi6怎么实现数据库备份及恢复?

chb592657370 发布于 2008-02-27 10:37, 1856 次点击
我是新手,哪位Delphi高手指点下,谢谢了。[bc04] [bc04]
5 回复
#2
chb5926573702008-05-17 20:44
怎么这么长时间还没有人回答呢?
#3
ruanjian21102008-06-14 13:18
帮顶,高手都跑哪里去了,知道的指点下.
#4
makebest2008-06-14 19:09
数据库?脑海中无数个影子闪过,不如是哪位大侠啊!
#5
lisatisfy2008-07-26 00:07
我也在找答案中..一起顶个
#6
yuutian2010-11-06 15:26
procedure tform1.Button6Click(sender:tobject);
begin
    if edit1.Text='' then
       ShowMessage('请选择需要恢复的数据库');
    if CopyFile(pchar(edit1.text),pchar('..\newfiledan.mdb'),false) then  //把数据库恢复(覆盖)到上层目录,文件名为newfiledan.mdb
    if Application.MessageBox('数据库恢复成功,请重新运行本程序!','恭喜',MB_YESNO)=6 then
       begin
       Application.Terminate;
       Exit;
       end
    else
       Close;
    if opendialog1.Execute then
       edit1.Text:=opendialog1.FileName;
    if CopyFile(pchar('newfiledan.mdb'),pchar('DB Backup\'+formatDateTime('yyyy-mm-dd_hh-mm',Now)+'.mdb'),false) then   //以当前的日期_时间命名备份的数据库
       Application.MessageBox('数据库备份成功,已以当前时间命名存至DB Backup文件夹中!','恭喜');
end;
end.




可以用用,我这是delphi7.0的代码。
1