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
Next
' Execute
oPKG.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
Else
sMessage = sMessage & "Step """ & oStep.Name & _
""" Succeeded" & vbCrLf & vbCrLf
End If
Next
oPKG.UnInitialize
Set oPKG = Nothing
Set oStep = Nothing
This package does work when I run it via SQL Enterprise Manager.
Any help in getting this to work would be most appreciated.