SSIS Script Task Code
Hi Guys,
I am using below code for dowload the excel from web site..but SSIS package running suceesfully thought, file are not downloaded. please advice me on it thanks
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.IO
Imports System.Net
<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
Public Sub Main()
'Address of URL
Dim URL As String = "http://vm1855lx38.engba.symantec.com/dashboard/showDashBoard#"
' Get HTML data
Dim client As WebClient = New WebClient()
Dim data As Stream = client.OpenRead(URL)
Dim reader As StreamReader = New StreamReader(data)
Dim str As String = ""
str = reader.ReadLine()
Do While str.Length > 0
Console.WriteLine(str)
str = reader.ReadLine()
Loop
End Sub
End Class
May 26th, 2012 5:06pm
put a breakpoint in your script and check is WebClient instanciate correctly? does Stream fetched correctly...?http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2012 9:47pm
there is a already method in webclient class as download file with specified formate useit.
this might give you a correct result.
thanksRegards, nishantcomp2512 Please mark posts as answered where appropriate
May 27th, 2012 12:04am