Y
yangjj
Unregistered / Unconfirmed
GUEST, unregistred user!
请看下面的代码,为什么这个函数不能拷贝生成新的文件?
procedure TmainForm.N5Click(Sender: TObject);
var
filename:string;
bn:integer;
begin
Application.CreateForm(Tfrmcreatfile, frmcreatfile);
frmCreatFile.showModal;
if bn=mrok then
filename:=ExtractFilePath(paramstr(0))+Inttostr(frmCreatFile.spinEdit1.value)+'.mdb';
if not fileexists(filename) then
begin
copyfile(PChar(extractfiledir(Application.exename)+'jhzb.mdb'),
PChar(extractfiledir(Application.exename)+filename),true);
messagebox(Handle,'本年度数据库文件新建成功','确定',
mb_ok or MB_ICONWARNING);
end
else
messagebox(Handle,'本年度数据库文件'+
#13#10+'已经存在,不用建立该年度文件。','警告',
mb_ok or MB_ICONWARNING);
exit;
end;
procedure TmainForm.N5Click(Sender: TObject);
var
filename:string;
bn:integer;
begin
Application.CreateForm(Tfrmcreatfile, frmcreatfile);
frmCreatFile.showModal;
if bn=mrok then
filename:=ExtractFilePath(paramstr(0))+Inttostr(frmCreatFile.spinEdit1.value)+'.mdb';
if not fileexists(filename) then
begin
copyfile(PChar(extractfiledir(Application.exename)+'jhzb.mdb'),
PChar(extractfiledir(Application.exename)+filename),true);
messagebox(Handle,'本年度数据库文件新建成功','确定',
mb_ok or MB_ICONWARNING);
end
else
messagebox(Handle,'本年度数据库文件'+
#13#10+'已经存在,不用建立该年度文件。','警告',
mb_ok or MB_ICONWARNING);
exit;
end;