我发现Delphi的BUG了??????!!!!!!(50分)

  • 主题发起人 主题发起人 ich4stone
  • 开始时间 开始时间
I

ich4stone

Unregistered / Unconfirmed
GUEST, unregistred user!
系统:windows2000 professional
开发环境: Delphi6.0 c/s 盗版(不知道有没有朋友使用正版的啊)
问题描述:
下面的源代码不能删除一个空目录。我调试了多次,只要把第二个索引项去掉,就可以
正常的删除空目录了。大家能告诉我为什么和怎么办吗?我试了,在windows2000 advance
server版里也有类似的问题。希望大家多多帮忙。
procedure TForm1.Button1Click(Sender: TObject);
var
tblTemp: TTable;
WorkDir: string;
WorkDB: string;
SearchRec: TSearchRec;
begin
WorkDir := 'c:/temp/';
WorkDB := 'temp.db';
if not DirectoryExists(WorkDir) then
if not ForceDirectories(WorkDir) then
Exit;
tblTemp := TTable.Create(nil);
with tblTemp do
begin
Active := False;
TableName := WorkDB;
TableType := ttParadox;
DatabaseName := WorkDir;
with FieldDefs do
begin
Clear;
with AddFieldDef do begin
Name := 'Field1';
DataType := ftInteger;
Required := True;
end;
with AddFieldDef do begin
Name := 'Field2';
DataType := ftInteger;
Required := True;
end;
with AddFieldDef do begin
Name := 'Field3';
DataType := ftInteger;
Required := True;
end;
end;
with IndexDefs do
begin
Clear;
{ The 1st index has no name because it is
{ a Paradox primary key }
with AddIndexDef do
begin
Name := '';
Fields := 'Field1';
Options := [ixPrimary];
end;
with AddIndexDef do//去掉以下的索引字段的定义,就可以删除空目录了
begin
Name := 'Fld2Indx';
Fields := 'Field2';
Options := [ixUnique];
end;
end;
CreateTable;
Open;
Close;
Free;
end;
if FindFirst(WorkDir+'*.*',faAnyFile,SearchRec) = 0 then
begin
repeat
if (SearchRec.Name = '.') or (SearchRec.Name = '..') then
else DeleteFile(WorkDir + SearchRec.Name);
until FindNext(SearchRec) <> 0;
FindClose(SearchRec);
end;
RemoveDir(WorkDir);
Showmessage(Inttostr(getlasterror));
end;
 
我推
关注中....
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
631
import
I
后退
顶部