all groups > sql server dts > september 2004 >
You're in the

sql server dts

group:

DTS pkg only runs once in my app?


DTS pkg only runs once in my app? Ron
9/28/2004 4:20:04 PM
sql server dts:
Hello again,

So, in my vb.net app I run a DTS package from a button.
No problem the first time. But if I click the same button
to run the same package, I get an error message that a
connection already exists. So I added an If statement
with a static integer var.

If var < 1 then
goPackage.Connections.Add(...)
End If
i += 1


But then I get an error at

CType(goPackage, DTS.Package).Tasks.Add(oTask)

So I do the If var < 1 then ...

Then I get an error than some transformation thing needs
to be specified. So, is it possible to re-run a DTS
package from a VB app without restarting the app?
Obviously something need to be reset to Nothing. How can
I re-run a DTS package in my app?

Thanks,
DTS pkg only runs once in my app? Ron
9/29/2004 8:25:02 AM
I think I found a solution. I placed all of the DTS
Module code into a class and invoke the class object, run
the dts code and set the class object to nothing. Then I
can re-run the class object as many times as I want. This
seems to work.

[quoted text, click to view]
DTS pkg only runs once in my app? Ron
9/29/2004 9:08:50 AM
Nope. Still crashing. If I loop through a collections of
text files (3 text files right now) and instantiate my
custom dts class for each text file, the procedure runs
fine the first time, and even the 2nd time. But the third
time I invoke the procedure, I get a variety of
erros, "Copy ... failed", "can't find the
package...", "Access violation"

Something is not being reset or emptied out. Any
suggestions appreciated.


[quoted text, click to view]
DTS pkg only runs once in my app? Ron
9/29/2004 12:39:04 PM
Just for reference, I think I came up with a solution.
YOu have to remove 2 connections which get added during
the execution of the dts package, you have to remove 1
step and you have to remove 1 task.

at the end of sub main (or could be called sub runDTS)
add this:

goPackage.Connections.Remove(2)
goPackage.Connections.Remove(1)
goPackage.Steps.Remove(1)
goPackage.Tasks.Remove(1)


[quoted text, click to view]
DTS pkg only runs once in my app? Ron
9/29/2004 6:39:21 PM
One more note: goPackage...Remove goes before
goPackage.UnInitialize. And also, keep the Module level
goPackage vars private. This is for when you have to
call the dts package multiple times while the app/project
is running.


[quoted text, click to view]
AddThis Social Bookmark Button