When i execute a package in VB.Net Windows Forms Application I receive an error "Error in Microsoft.Dts.SQlServer.Runtime.Package". The package is attempting to configure from XML File <XMLFileName>. Please note that the <XMLFileName>
is valid.
The error occurs when LoadPackage line is invoked. I tried supressing the warning. I am not sure how to pass the config file when loading the package.
Imports Microsoft.SqlServer.Dts.Runtime
Public MustInherit Class SSISExecutePackage
Public Shared Sub ExecutePackage(ByVal configPath As String)
Dim pkgLocation As String
Dim pkg As New Microsoft.SqlServer.Dts.Runtime.Package
Dim app As New Microsoft.SqlServer.Dts.Runtime.Application
Dim eventListener As New EventListener()
Dim pkgResults As Microsoft.SqlServer.Dts.Runtime.DTSExecResult
pkgLocation = "TestArchive.dtsx" pkg.SuppressConfigurationWarnings = True
Try
pkg = app.LoadPackage(pkgLocation, eventListener)
Catch ex As Exception
End Try
pkgResults = pkg.Execute(Nothing, Nothing, eventListener, Nothing, Nothing)
MessageBox.Show(pkgResults.ToString())
End Sub
End Class
Class EventListener
Inherits Microsoft.SqlServer.Dts.Runtime.DefaultEvents
Public Overrides Sub OnInformation(ByVal source As Microsoft.SqlServer.Dts.Runtime.DtsObject, _
ByVal errorCode As Integer, ByVal subComponent As String, ByVal description As String, _
ByVal helpFile As String, ByVal helpContext As Integer, _
ByVal idofInterfaceWithError As String, ByRef fireAgain As Boolean)
' Add application–specific diagnostics here.
MessageBox.Show(String.Format("Error in {0}/{1} : {2}", source, subComponent, description))
End Sub
Public Overrides Sub OnProgress(ByVal taskHost As Microsoft.SqlServer.Dts.Runtime.TaskHost, ByVal progressDescription As String, ByVal percentComplete As Integer, ByVal progressCountLow As Integer, ByVal progressCountHigh As Integer, ByVal subComponent
As String, ByRef fireAgain As Boolean)
MessageBox.Show(String.Format("Error in {0}/{1} : {2}", progressDescription, percentComplete, progressCountLow))
End Sub
Public Overrides Function OnError(ByVal source As Microsoft.SqlServer.Dts.Runtime.DtsObject, _
ByVal errorCode As Integer, ByVal subComponent As String, ByVal description As String, _
ByVal helpFile As String, ByVal helpContext As Integer, _
ByVal idofInterfaceWithError As String) As Boolean
' Add application–specific diagnostics here.
MessageBox.Show(String.Format("Error in {0}/{1} : {2}", source, subComponent, description))
Return False
End Function
End Class