向ftp服务器 写入文件失败,关于从FTp服务器取回文件写入数据表时提示:file not found(2)...

当前位置:我的异常网» Delphi » 关于从FTp服务器取回文件写入数据表时提示:file not

关于从FTp服务器取回文件写入数据表时提示:file not found(2)

www.myexceptions.net  网友分享于:2015-08-26  浏览:29次

end;

end;

end;

//FTp连接

function TFtpDatFrm.FuncConnectFTP(var AErrMsg: string): integer;

begin

Result := -1;

if not IdFTP1.Connected then

try

IdFTP1.User := ps_UserName;

IdFTP1.Password := ps_PassWord;

IdFTP1.Host := ps_ServerIP;

IdFTP1.Port := StrToInt(ps_Port);

IdFTP1.Connect;

if not IdFTP1.Connected then exit;

Except

On E:Exception do

begin

ProcMemoAdd( E.Message);

exit;

end;

end;

Result := 0;

end;

//将数据从文件写入数据表中,Orale9i

procedure TFtpDatFrm.ProcUpdateData(p_type:integer);

var

v_i,v_II:integer;

v_s,v_zmzh,v_spbm,v_xql,V_hdl,v_filename,v_khjlbm,v_cjy,v_khbm,vsql:string;

ttt,ff:TextFile;

pInfile:string;

v_dir,v_filedirname:string;

FileStream:TFilestream;

begin

try

ADOConnection.BeginTrans;

with Aqry do

begin

close;

sql.Clear;

if p_type=1 then

sql.Add('truncate table TEMP_QT_XQHDL');

if p_type=0 then

sql.Add('truncate table TEMP_TABLE_KCZ');

vsql:=Aqry.SQL.text;

ExecSQL;

end;

ADOConnection.CommitTrans;

except

on e:exception do

begin

ADOConnection.RollbackTrans;

//Application.MessageBox(pchar('清空青铜数据出错:'+e.Message),'提示');

ProcMemoAdd('清空青铜数据出错:'+e.Message);

exit;

end;

end;

v_dir:=ExtractFilePath(Application.ExeName);

v_filedirname:=v_dir+'new\Imput.ctl';

AsSignFile(ttt,v_filedirname);

//if Not FileExists(v_filedirname) then ReWrite(ttt)

// else Append(ttt);

if FileExists(v_filedirname) then

Application.MessageBox(pchar('文件存在'),'提示')

else Application.MessageBox(pchar('文件不存在'),'提示');

ReWrite(ttt) ;

Writeln(ttt,'load data');

if p_type=1 then

FlbFiles.ApplyFilePath(ExtractFilePath(Application.ExeName) + 'FilesDownLoad_flow\');

if p_type=0 then

FlbFiles.ApplyFilePath(ExtractFilePath(Application.ExeName) + 'FilesDownLoad_userstore\');

for v_II:=0 to FlbFiles.Items.Count-1 do

begin

v_filename:=FlbFiles.Items.Strings[v_II];

if p_type=1 then

if Copy(v_filename,length(v_filename)-15,12)=ps_flow then

Writeln(ttt,'infile '''+ExtractFilePath(Application.ExeName) + 'FilesDownLoad_flow\'+v_filename+'''');

{if p_type=0 then

if Copy(v_filename,length(v_filename)-25,22)=ps_userstore then

Writeln(ttt,'infile '''+ExtractFilePath(Application.ExeName) + 'FilesDownLoad_userstore\'+v_filename+''''); }

end;

if p_type=1 then

begin

Writeln(ttt,'append into table TEMP_QT_XQHDL ');

Writeln(ttt,'(khbm POSITION(01:12),spbm POSITION(14:21),CJYXQL POSITION(27:31),CJYHDL POSITION(32:36),SYXQL POSITION(37:41),SYHDL POSITION(42:46),SYXSL POSITION(47:51))');

end ;

{else

begin

Writeln(ttt,'append into table TEMP_TABLE_KCZ ');

Writeln(ttt,'(zmzh POSITION(01:12),spbm POSITION(13:23),kcz POSITION(24:33),pdrq POSITION(34:41),cjrq POSITION(42:49))');

end;}

CloseFile(ttt);

AsSignFile(ff,ExtractFilePath(Application.ExeName)+'new\Imput.bat');

ReWrite(ff) ;

Writeln(ff,'c:');

Writeln(ff,'sqlldr userid='+ps_ConnUser+'/'+ps_ConnPassWord+'@'+ps_Sid+' control='+ExtractFilePath(Application.ExeName)+'Imput.ctl');

文章评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值