Wrox Programmer Forums
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 7th, 2005, 04:09 PM
Authorized User
Join Date: Dec 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling a DTS Package from VB

I'm trying to call a DTS package(SQL 2000) from VB(6.0) but I'm getting permission errors on the tables I'm trying to perform operations on (even though I've granted the public user complete access to this tables). The DTA package is on a remote server, the code is running on a local machine.

Here is the code I'm using to try to run the package:
Dim oPKG As DTS.Package, oStep As DTS.Step
Dim sPackageName As String, sMessage As String
Dim lErr As Long, sSource As String, sDesc As String

    Set oPKG = New DTS.Package

    oPKG.LoadFromSQLServer "RSLNY2-0161", "", "", _
        "256", , , , "VoughtExtract"
' oPKG.Execute

     ' Set Exec on Main Thread
    For Each oStep In oPKG.Steps
        oStep.ExecuteInMainThread = True

' Execute

    ' Get Status and Error Message
    For Each oStep In oPKG.Steps
        If oStep.ExecutionResult = DTSStepExecResult_Failure Then
            oStep.GetExecutionErrorInfo lErr, sSource, sDesc
            sMessage = sMessage & "Step """ & oStep.Name & _
                """ Failed" & vbCrLf & _
                vbTab & "Error: " & lErr & vbCrLf & _
                vbTab & "Source: " & sSource & vbCrLf & _
                vbTab & "Description: " & sDesc & vbCrLf & vbCrLf
            sMessage = sMessage & "Step """ & oStep.Name & _
                """ Succeeded" & vbCrLf & vbCrLf
        End If

    Set oPKG = Nothing
    Set oStep = Nothing

Any help in getting this to work would be most appreciated.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting DTS Package into VB.NET 2005 vish_vj ADO.NET 0 March 1st, 2008 01:54 AM
Calling an SP from a DTS Package? Gibi SQL Server DTS 1 April 18th, 2007 05:47 AM
Calling DTS package from VBA tcarnahan SQL Server DTS 2 October 13th, 2004 10:05 PM
VB.Net -> Filename -> DTS Package -> tempdB daniel Pro VB.NET 2002/2003 1 October 7th, 2004 01:46 PM
converting DTS package from VB 6 to VB .NET petroleo Pro VB Databases 0 August 18th, 2003 05:01 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.