Parameter in DTS using VB.Net

  • Hi to All,

    I am trying to write a program which will do a DTS based on a given value. This will be done in VB.net

    When i create a DTS package, save it as new.dts and call this file in my vb.net code, it runs fine. This dts package just transfer data from 1 db to another.

    Then i create another dts where in i make a querry so that it will ask for an input value, based on this, rows can be transfered. After looking at the BOL, i added my query like this for the source db:

    select * from table1 where col1=?

    and added a globalvariables as 'SelID'

    Now when i run the program from the vb.net code, there are no rows transfered and no errors. I give below my code:

    Dim package As DTS.Package2Class

    package =

    New DTS.Package2Class

    Dim filename As String

    Dim password As String

    Dim packageID As String

    Dim versionID As String

    Dim name As String

    Dim pVarPersustStgOfHost As Object

    filename = "c:\New.dts"

    password = ""

    packageID = ""

    versionID = ""

    name = "New"

    ' assign the global variable a value here

    package.GlobalVariables.Item("newSUID").Value = "1.3.6.1.4.1.2452.6.120050221.20844.304.1416026628"

    pVarPersustStgOfHost =

    Nothing

    package.LoadFromStorageFile(filename, _

    password, packageID, versionID, _

    name, pVarPersustStgOfHost)

    Try

    package.Execute()

    Catch ex As Exception

    MsgBox(ex.ToString)

    Finally

    package.UnInitialize()

    package =

    Nothing

    End Try

    Some one pls let me know why there are no rows transfered.

    I am new to DTS.

     

    Thanks for all the replies.

  • This was removed by the editor as SPAM

  • Do you have to run the DTS package using VB.net? Can you just run DTS package by itselft ?  DTS package can pass parameter.

  • Hi,

    This program has to run on a computer where it doesnt have SQL server.

    When i save the package as vb code, it runs fine, i can convert the code to vb.net and after correcting for the conversion issues, it works fine.

    But when the package is saved as a dts package, it doesnt work.

    Thats my question why it wont work.

    kesk

  • a dts package that uses sql statements must have a conection to a database of any kind. if it doesn't have it won't work. if the computer you run the dts package on doesn't have sql server installed then the connection in the package can use a server on the network that must be supplied either inside the package or passed as a parameter into the package at the moment of run.

    Don't just give the hungry man a fish, teach him how to catch it as well.

    the sqlist

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply