请问我这段程序哪儿有问题!!每次执行后都显示一个错误(一个用做数据恢复的程序)
not found the file" c:\windows\stumanagement.mdb"
'c:\windows\'为opendialog1中的路径!!
procedure TMainForm.datahuifu(Sender: TObject);
var
dir:string;
a:integer;
begin
dir:=ExtractFilePath(application.ExeName)+'stumanagement.mdb';
loginForm.adoconnection1.Connected:=false;
.......
c_DengJiForm.adoconnection1.Connected:=false;
if opendialog1.Execute then
begin
if copyfile(pchar(dir),pchar(opendialog1.FileName),false)=true then
showmessage('数据恢复成功')
else
showmessage('数据恢复出错');
end;
loginForm.adoconnection1.Connected:=true;
......
cfoundform.ADOConnection1.Connected:=true;
end;
not found the file" c:\windows\stumanagement.mdb"
'c:\windows\'为opendialog1中的路径!!
procedure TMainForm.datahuifu(Sender: TObject);
var
dir:string;
a:integer;
begin
dir:=ExtractFilePath(application.ExeName)+'stumanagement.mdb';
loginForm.adoconnection1.Connected:=false;
.......
c_DengJiForm.adoconnection1.Connected:=false;
if opendialog1.Execute then
begin
if copyfile(pchar(dir),pchar(opendialog1.FileName),false)=true then
showmessage('数据恢复成功')
else
showmessage('数据恢复出错');
end;
loginForm.adoconnection1.Connected:=true;
......
cfoundform.ADOConnection1.Connected:=true;
end;
解决方案 »
- inno setup [code] 段问题
- Delphi 可否使用类似于以下的dll(其提供了一个创建和销毁类的函数)
- 用ADOConnection可以鏈接BDE數據庫么?
- 怎样在delphi中判断sql server2000主键是否重复
- 怎样能如何改变TProgressBar的颜色?
- 求mapgis文件浏览控件??谁有啊,给发一个.
- 怎样清除Canvas画布中的内容?
- 请问win2K中svchost.exe文件是啥作用?是不是和COM+有关?
- 100分 如何实现多层结构的数据同步Transaction
- 怎样得到当前执行文件的路径,
- 报表字段在一行中显示不下,如何让它在换行后还能和值交替显示?
- SQL高手快来拿分!!!!
你是不是想把 opendialog1.filename 复制到 dir? 该成
copyfile(pchar(opendialog1.FileName),pchar(dir),false)
你的程序应该是没问题的,我没DELPHI不能帮你试了
本来就带有‘/’号的
根本不用增加
得楼主在文件拷贝的过程中并没有任何问题
重点是要查看一下你的ADOCONNECTION的CONNECTSTRING中是否指明了'stumanagement.mdb'文件的目录
从代码上看到你用了两个CONNECTION不知是否是一样的?
最好用单步调试来查找下在到底在哪一步报错?