
September 22nd, 2012, 03:10 AM
|
Registered User
|
|
Join Date: Sep 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Zip text file through C# or VB.Net
Hi,
i have activeX script for file zipping but winzip hangs during my schedule job. i am very new to SSIS and need some help to transform this activeX script into Script task. Any help will be much appreciated.
my code is as follows:
Quote:
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Function Main()
dim oshell, strdate, strzip_pwd
set oshell = createobject("WScript.shell")
strzip_pwd = Get_Zip_Access()
strdate = mid(now,7,4) & mid(now,4,2) & mid(now,1,2)
DTSGlobalVariables("@ZipFileName") = "Service_Desk_Corporate_Extract_" & strdate & ".zip"
oshell.run "winzip32 -a -P -r -s" & strzip_pwd & " \\w2k4432\Non_NAS_Migration\Data_Management\Data_F eeds\Corporate\Extracts\" & DTSGlobalVariables("@ZipFileName") & " \\w2k4432\Non_NAS_Migration\Data_Management\Data_F eeds\Corporate\Extracts\" & DTSGlobalVariables("@ExtractFileName"),SW_HIDE,Tru e
set oshell = nothing
Main = DTSTaskExecResult_Success
End Function
Function Get_Zip_Access()
dim myConn
dim myRecordset
dim mySQLCmdText
set myConn = CreateObject("ADODB.Connection")
set myRecordset = CreateObject("ADODB.Recordset")
myConn.Open "Provider=sqloledb;" & _
"Data Source=w2k4432;" & _
"Database=Zip_Access;" & _
"Integrated Security=SSPI"
mySQLCmdText = "Select * From tblZip_Access where ([From] <= GETDATE()) AND ([To] >= GETDATE())"
myRecordset.Open mySQLCmdText, myConn
if myRecordset.eof = true Then
Get_Zip_Access = "No Password"
else
Get_Zip_Access = myRecordset("password") & ""
end if
End Function
|
|