Results 1 to 5 of 5

Thread: DTS - please help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2001
    Posts
    19

    Question DTS - please help

    I have used following code to execute DTS package from VB.
    The problem I am having is, that it works fine from some pc but not with others. For example it gives me error of %1 not found, but on DBO'S machine it works fine. I have SQL 7 and he has SQL 2000.
    I am new at VB so please give details/more explanations or references.


    Private Sub RunPackage()

    '*************Code to execute DTS Package*********
    'Run DTS Package to create temptbl

    Dim oPKG As DTS.Package, oStep As DTS.Step, oTask As DTS.Task
    Set oPKG = New DTS.Package

    oPKG.LoadFromSQLServer "SERVER IP ADDR", "DATABASEUSERID", "DATABASE PASSWORD", _
    DTSSQLStgFlag_Default, "package password", , , "package name"


    ' Set Exec on Main Thread
    oPKG.Execute

    Set oPKG = Nothing
    '*************End of Code to execute DTS Package*********
    End Sub

  2. #2
    Fanatic Member RSINGH's Avatar
    Join Date
    May 2001
    Location
    London
    Posts
    522
    This was covered on another thread. There's some useful info and resources here
    The liver is bad. It must be punished.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2001
    Posts
    19
    Thank You Rsingh.. for replying.
    In fact I have used that from previous thread.. but had trouble executing from VB.. can you please help me out with how I would execute this sp from VB..

  4. #4
    Fanatic Member RSINGH's Avatar
    Join Date
    May 2001
    Location
    London
    Posts
    522
    When you try this on a colleages machine, do you do a full install of the application or do you just run the exe?

    Also try using the stored procedure code from the other machine of the form

    spRunPackage 'NameofPackage' through Query Analyzer to check that that is working.

    Try the above and we'll see where are.
    The liver is bad. It must be punished.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2001
    Posts
    19
    I have used following code to execute procedure from Vb.

    Private Sub RunPackage2()

    Dim rsDts As New ADODB.Recordset

    If OpenSQLServerConnection = False Then
    MsgBox "There was an error opening the connection to SQL Server. Please call for support.", vbInformation, Me.Caption
    Exit Sub
    End If


    Set rsDts = cn.Execute("spRunPackage '" & CheckFileImport & "'")
    CloseSQLServerConnection


    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width