Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI all i am newbe to ssis and i got a requirement where i need to transfer data from ser to other so i created a ssis package using sql server import export wizard and saved the .dtsx file on c:\ i browsed abt using it in vb and i found some code i used that code and ran it for a test and i am getting the success message but when i query my table i have no luck i tested my package in BIDS and it is working fine there, i am not sure if i am doing something wrong in my vb code, below is the code i am using for executing a package.i added this dll as refrence to my solution Microsoft.SqlServer.ManagedDTS.dll.
can some one please help me out giving some advises and sources to get thru this problem. Thanks in advance




Imports Microsoft.SqlServer.Dts.Runtime


Public Class ssistest

    Private Sub ssistest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        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 = "C:\name.dtsx"
        pkg.Variables.Add("symbol", False, "User", "MPC        ")
        pkg.Variables.Add("time1", False, "User", Convert.ToDateTime("2011-07-07 03:31:10.000"))
        pkg.Variables.Add("time2", False, "User", Convert.ToDateTime("2011-07-08 03:31:42.000"))

        pkg = app.LoadPackage(pkgLocation, eventListener)


        pkgResults = pkg.Execute(Nothing, Nothing, eventListener, Nothing, Nothing)
        MessageBox.Show(pkgResults.ToString())

        Me.Close()

    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
Posted
Comments
makwith9789 17-Nov-11 10:23am    
Am I not clear with the question please let me know i can elobarate more to get a better help with situation
coded007 18-Nov-11 12:09pm    
Please check permissions of the user whether user has permissions to execute ssis package or not

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900