代码目的:将某一目录下的所有文件名注册到数据库中!
出现问题:文件名全是:'.' 死循环
有代码如下:
procedure TF_Demo.oxButton1Click(Sender: TObject);
var
Found:TSearchRec; { 申明Tp为一个查找记录 }
T1,T2,a:string;
stopsearch:boolean;
Finished,i:Integer;
begin
i:=1;
stopsearch:=false;
Finished := FindFirst('upload'+'\*.*', 63 ,Found); { 查找目标文件 }
while (Finished = 0 ) do
begin
if (found.name<>' ') then //该地方如何解决死循环????
begin
T1:=FormatDateTime(Model,CovFileDate(found.FindData.ftCreationTime)); { 返回文件的创建时间 }
T2:=FormatDateTime(Model,CovFileDate(found.FindData.ftLastWriteTime)); { 返回文件的修改时间 }
a:=trim(found.name);
showmessage(a);
asp_ins_files_info.Parameters.ParamValues ['@fn']:=trim(a);
asp_ins_files_info.Parameters.ParamValues ['@reg_time']:=trim(t2);
asp_ins_files_info.ExecProc ;
end;
end;
findclose(found);
Label1.Caption :=t1;
Label2.Caption :=t2;
end;
出现问题:文件名全是:'.' 死循环
有代码如下:
procedure TF_Demo.oxButton1Click(Sender: TObject);
var
Found:TSearchRec; { 申明Tp为一个查找记录 }
T1,T2,a:string;
stopsearch:boolean;
Finished,i:Integer;
begin
i:=1;
stopsearch:=false;
Finished := FindFirst('upload'+'\*.*', 63 ,Found); { 查找目标文件 }
while (Finished = 0 ) do
begin
if (found.name<>' ') then //该地方如何解决死循环????
begin
T1:=FormatDateTime(Model,CovFileDate(found.FindData.ftCreationTime)); { 返回文件的创建时间 }
T2:=FormatDateTime(Model,CovFileDate(found.FindData.ftLastWriteTime)); { 返回文件的修改时间 }
a:=trim(found.name);
showmessage(a);
asp_ins_files_info.Parameters.ParamValues ['@fn']:=trim(a);
asp_ins_files_info.Parameters.ParamValues ['@reg_time']:=trim(t2);
asp_ins_files_info.ExecProc ;
end;
end;
findclose(found);
Label1.Caption :=t1;
Label2.Caption :=t2;
end;
if (found.name[1]<>'.') and (found.name<>'')
.....