[求助]如何制作备份恢复界面
我是一个新手,试着为单位编了档案管理系统,曾从别人的程序里移植了一个备份恢复界面,但备份恢复时旧记录没有删除,出现旧记录+新记录情况。各位大侠帮忙看一下。开始备份按键代码:
thisform.olecontrol1.max=10 &&进度条
tmpdir=allt(thisform.pageframe1.page1.text1.value)+"\"
thisform.label2.Visible=.t.
thisform.label2.Caption="正在备份数据,请稍后..."
SELECT 用户
bakfile=tmpdir+"用户备份"
COPY TO &bakfile
thisform.olecontrol1.value=2
SELECT 借阅
bakfile=tmpdir+"借阅备份"
COPY TO &bakfile
thisform.olecontrol1.value=5
SELECT 裕检档案
bakfile=tmpdir+"裕检档案备份"
COPY TO &bakfile
thisform.olecontrol1.value=10
nn=MESSAGEBOX("数据备份完毕...",0+64,"信息")
thisform.olecontrol1.value=0
thisform.label2.Visible=.F.
开始恢复按键代码:
thisform.olecontrol1.max=3
tmpdir=allt(thisform.pageframe1.page2.text1.value)+"\"
thisform.label2.Visible=.t.
thisform.label2.Caption="正在恢复数据,请稍后..."
YesNo=0
SELECT 裕检档案
WAIT windows "尝试锁定表... 按 ESC 取消!" nowait
IF !FLOCK()
wait window "表锁定失败!数据恢复不成功,请稍候再试。" timeout 1
YesNo=1
ELSE
WAIT CLEAR
DELETE ALL
bakfile=tmpdir+"裕检档案备份.dbf"
IF FILE(bakfile)
APPEND FROM &bakfile
ELSE
=MESSAGEBOX("数据文件"+bakfile+"不存在...",0+48,"错误")
YesNo=1
ENDIF
UNLOCK
ENDIF
thisform.olecontrol1.value=1
SELECT 借阅
WAIT windows "尝试锁定表... 按 ESC 取消!" nowait
IF !FLOCK()
wait window "表锁定失败!数据恢复不成功,请稍候再试。" timeout 1
YesNo=1
ELSE
WAIT CLEAR
DELETE ALL
bakfile=tmpdir+"借阅备份.dbf"
IF FILE(bakfile)
APPEND FROM &bakfile
ELSE
=MESSAGEBOX("数据文件"+bakfile+"不存在...",0+48,"错误")
YesNo=1
ENDIF
UNLOCK
ENDIF
thisform.olecontrol1.value=2
SELECT 用户
WAIT windows "尝试锁定表... 按 ESC 取消!" nowait
IF !FLOCK()
wait window "表锁定失败!数据恢复不成功,请稍候再试。" timeout 1
YesNo=1
ELSE
WAIT CLEAR
DELETE ALL
bakfile=tmpdir+"用户备份.dbf"
IF FILE(bakfile)
APPEND FROM &bakfile
ELSE
=MESSAGEBOX("数据文件"+bakfile+"不存在...",0+48,"错误")
YesNo=1
ENDIF
UNLOCK
ENDIF
thisform.olecontrol1.value=3
IF yesNo=0
nn=MESSAGEBOX("数据恢复完毕...",0+64,"信息")
ELSE
nn=MESSAGEBOX("数据恢复不成功...",0+64,"信息")
ENDIF
thisform.olecontrol1.value=0
thisform.label2.Visible=.f.