代码如下,它为什么不执行错误处理,一发生错误运行就死掉呢?procedure TForm1.btcnClick(Sender: TObject);
begin
idftp1.Host:=edithost.Text;
idftp1.Port:=21;
idftp1.Username:=edit1.Text ;
idftp1.Password :=edit2.Text ;
try
idftp1.Connect() ;
except
showmessage('登陆信息错误!');
end
end;
begin
idftp1.Host:=edithost.Text;
idftp1.Port:=21;
idftp1.Username:=edit1.Text ;
idftp1.Password :=edit2.Text ;
try
idftp1.Connect() ;
except
showmessage('登陆信息错误!');
end
end;
解决方案 »
- 请教findchildcontrol的问题
- Delphi中关于用string类型进行循环的问题
- 有没有能粘贴图片和输入文字的控件啊?
- 关于ComboBox与数据难点
- 串口接收数据时,运行几次后,提示variant or safe array index of out bounds错误!!求助各位朋友!谢谢!!
- SQL Server的棘手的问题,请专家解答!
- 这个事务错在哪,我分别写在两个button里?
- 求救!!!!(急) dbgrid的问题
- 求助DELPHI高手帮帮忙吖
- 新手常遇到的,书上有没有讲的问题
- 高手指教:怎样得到Tree节点所对应数据库的值!
- 关于软件看门狗的问题,大家一起探讨一下
filename,RemoteFile,path: String;
idftp1: TNMFTP;
S: TSaveDialog;
begin
idftp1 := TNMFTP.Create(nil);
S := TSaveDialog.Create(nil);
if idftp1.Connected then
idftp1.Disconnect
else
begin
idftp1.Host := '192.168.0.76';
idftp1.Port := 21;
idftp1.UserID := 'oracle';
idftp1.Password := 'oracle';
try
idftp1.Connect();
except
Messagedlg('登陆信息错误!',mtCustom,[mbOk],0);
end;
end;
这里没有出现死运行
idftpRecord.Host := Host;
idftpRecord.Port := Port;
idftpRecord.Username := UserName;
idftpRecord.Password := Password;
try
try
idftpRecord.Connect(true);
except
on E: Exception do begin
ErrorMsg := '连接Ftp服务器失败:' + E.Message;
Result := false;
Exit;
end;
end;
try
idftpRecord.Login;
except
on E: Exception do begin
ErrorMsg := '登陆服务器失败:' + E.Message;
Result := false;
Exit;
end;
end;
finally
end;
ErrorMsg := '连接FTP服务器成功';
Result := true;