为什么保存可以,我用逐步调试,打开也可以,可是为什么
CopyFile(openFile,newFile, false); 执行后没有经过,也就是没有用,谢谢,
CopyFile(openFile,newFile, false); 执行后没有经过,也就是没有用,谢谢,
解决方案 »
- 请教大大,delphi使用xmlhttp的问题
- 想问下Object Inspector是什么
- 请问该如何使用GDI+控件?
- 为什么在tChart动态添加 Series 后 不能 显示出来 ?????????????????????????? 急!!!!!!!!!
- 如何判断一个字符是否为数字,请高手指教,急!!
- DBGrid中如何让回车变为光标右移动?
- 简单问题:PaintBox1如何清空画面
- How to add a nonscrolling region to a topic ?
- mdifrom 如何知道 它的子窗口的 当前位置?
- E-mail程序开发小问题.
- 初学者的问题,如何删除adodataset的所有记录?
- 用CreateRectRgn创建了一个区域后如何偏移它?????急!!!!
begin
self.openDialog1.InitialDir:='d:\PHS_SYSTEM\PHS.MDB';
if self.openDialog1.FileName='' then exit else
begin
openfile:=pchar(self.openDialog1.filename+'.MDB') ;
newfile:='D:\PHS_SYSTEM\PHS.MDB';
CopyFile(openFile,newFile, false);
end;
end;逐步调试,没错,追后COPYFILE 没有 newfile:='D:\PHS_SYSTEM\PHS.MDB';
为已经连接好的数据库,而我希望被OPENFILE覆盖
if openDialog1.Execute then
begin
self.openDialog1.InitialDir:='d:\PHS_SYSTEM\PHS.MDB';
if self.openDialog1.FileName='' then exit else
begin
openfile:=pchar(self.openDialog1.filename+'.MDB') ;
newfile:='D:\PHS_SYSTEM\PHS.MDB';
////////////////Debug/////////////////////
ShowMessage(OpenFile);
ShowMessage(NewFile);
if not FileExists(OpenFile) then
ShowMessage('源文件不存在,所以出错!')
if FileExists(NewFile) then
ShowMessage('还有可能是目标文件已经存在');
////////////////Debug/////////////////////
CopyFile(openFile,newFile, false);
end;
end;
我的 newfile:='D:\PHS_SYSTEM\PHS.MDB'; 已经用ODBC连好了,是不是不行
主要不能覆盖
var
MessageStr: string;
Size: Integer;
begin
Size := 256;
SetLength(Messagestr, Size);
Size := FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
nil,
GetLastError,
0,
PChar(MessageStr),
Size,
nil);
SetLength(MessageStr, Size - 2);
ShowMessage(MessageStr);
end;
...
if Not CopyFile(openFile,newFile, false) then
ShowLastError;
好象覆盖不了 ,
var
MessageStr: string;
Size: Integer;
begin
Size := 256;
SetLength(Messagestr, Size);
Size := FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
nil,
GetLastError,
0,
PChar(MessageStr),
Size,
nil);
SetLength(MessageStr, Size - 2);
ShowMessage(MessageStr);
end;....if Not CopyFile(openFile,newFile, false) then
ShowLastError;
Phs
---------------------------
其他进程正使用该文件,
因此现在无法访问。
---------------------------
OK
---------------------------怎么办呢,
有别的办法打开保存的数据库吗,
不过我的ODBC 连在刚才
self.openDialog1.InitialDir:='d:\PHS_SYSTEM\PHS.MDB';
也就是在我要保存的地方,