procedure TMain.N2Click(Sender: TObject);
var
F:TShFileOpStruct;
begin
if (login.admin<>true) then
messagebox(getactivewindow(),'你无权进行此操作,请联系管理员!','错误!' ,MB_OK + MB_ICONINFORMATION)
else
begin
F.wnd:=Handle;
F.wFunc:=Fo_COPY;
F.pFrom:=pAnsichar(ExtractFileDir(Application.ExeName)+'计费系统.mdb'+#0);
F.pTo:=pAnsichar('db.bak') ;
if ShFileOperation(F)<>0 then
MessageBox(getactivewindow(), '数据文件备份失败!', '错误', MB_OK + MB_ICONSTOP)
else
MessageBox(getactivewindow(), '数据文件备份成功!', '成功', MB_OK + MB_ICONINFORMATION);
end;
end;这段代码是我从别人那里拷贝的,可为什么执行不了,谢谢解释一下这段程序,如果哪位大侠有本地数据库备份的程序,给我看看,了
var
F:TShFileOpStruct;
begin
if (login.admin<>true) then
messagebox(getactivewindow(),'你无权进行此操作,请联系管理员!','错误!' ,MB_OK + MB_ICONINFORMATION)
else
begin
F.wnd:=Handle;
F.wFunc:=Fo_COPY;
F.pFrom:=pAnsichar(ExtractFileDir(Application.ExeName)+'计费系统.mdb'+#0);
F.pTo:=pAnsichar('db.bak') ;
if ShFileOperation(F)<>0 then
MessageBox(getactivewindow(), '数据文件备份失败!', '错误', MB_OK + MB_ICONSTOP)
else
MessageBox(getactivewindow(), '数据文件备份成功!', '成功', MB_OK + MB_ICONINFORMATION);
end;
end;这段代码是我从别人那里拷贝的,可为什么执行不了,谢谢解释一下这段程序,如果哪位大侠有本地数据库备份的程序,给我看看,了
解决方案 »
- 数据库相关delphi分页查询
- 请问,delphi如何打印特殊票据呀?
- delphi阶段性学习.
- 如何将报表组合后打印?
- 如何通过程序打开一个超链接:如http://www.sohu.com语句如何写?
- 用过DELPHI7的进来聊聊,UP有分!!!有关dbexpreess 组件的问题!!!!
- 请问像迅雷等软件的边框半透明阴影是怎么实现的?能提供个思路吗?
- delphi5 和 delphi6能安全共存吗?
- table的maxrecord=10不管用?取出了所有数据
- 怎样将query的结果返回给窗体?
- 如何把clipboard上的文本数据copy到光标所在的位置?
- 3000元现金求购IP隐藏、指定显示IP源代码
var
MyFileName: string;
begin
MyFileName := '';
try
if SaveDialog1.Execute then
begin
MyFileName := SaveDialog1.FileName;
if MyFileName <> '' then
begin
if CopyFile(Pchar(ExtractFilePath(Application.ExeName) + 'HYTJ.mdb'), Pchar(MyFileName), false) then
begin
Application.MessageBox('数据备份成功','提示',Mb_ok + mb_iconinformation);
end;
end;
end;
except
Application.MessageBox('数据备份失败','提示',Mb_ok + mb_iconError);
end;
end;procedure TFormMain.RestorDateClick(Sender: TObject);
var
MyFileName, aa: string;
begin
MyFileName := '';
try
if OpenDialog1.Execute then
begin
MyFileName := OpenDialog1.FileName;
if MyFileName <> '' then
begin
aa := ExtractFilePath(Application.ExeName) + 'HYTJ.mdb';
if CopyFile(Pchar(MyFileName),Pchar(aa), false) then
begin
DM.ADOConnect.Close;
DM.ADOConnect.Open;
Application.MessageBox('数据恢复成功','提示',Mb_ok + mb_iconinformation);
end;
end;
end;
except
Application.MessageBox('数据恢复失败','提示',Mb_ok + mb_iconError);
end;
end;