2008年3月20日 星期四

在DTS中使用Activex 工作處理檔案

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()
dim fs,strfullpath,f
set fs=createobject("Scripting.FileSystemObject")
if (fs Is Nothing) then

Main=DTSTaskExecResult_Failure
'msgbox "1"
exit function

end if
strfullpath="D:\SFBAFK\BISsys\DATA\lnctbtt.dat"
if not fs.fileexists(strfullpath) then

Main=DTSTaskExecResult_Failure
'msgbox "2"
set fs=nothing
exit function
end if

Set f = fs.GetFile(strfullpath)


if f.size =0 then

Main=DTSTaskExecResult_Failure
'msgbox ""
set fs=nothing
exit function
end if
set fs=nothing
'msgbox "4"
'Main=DTSTaskExecResult_Failure
Main=DTSTaskExecResult_Success
End Function

沒有留言: