Dts pkg problem in vb.net - OK vb6


R

Ron

Hello,

I can run a dts package in a vb6 app multiple times. If I
run the same package once in a vb.net project, it runs
fine (did all the dotnet syntax conversions...). If I try
to run the dts package multiple times in the vb.net
project the package fails (I have all the references to
DTS Com object library, DTS com DataPump, DTS tasks). I
ran the package in vb.net from a standard module. I can
only run the package once that way and then need to
restart the app/project to re-set something in dts. So I
put the dts package code in a project class module. Now I
can run the package multiple times except...I want to
import several text files to Sql Server. If I loop
through the collection of text files once, dts is OK.
Loop through it again, dts is OK. But if I click my "Run
DTS" button a third time, the dts package class (my custom
class) fails. Error message says something
about "Exception - calling a virutal function..."

In the VB6 app, the dts package runs fine right straight
from the standard module. I can loop through it to my
heart's content. I would really desire to not have to
call a vb6.exe from my vb.net project if I can help it to
run the dts package. Surely, if I can manipulate DTS in
vb6 - it should be doable in vb.net in the same manner.
Any suggestions greatly appreciated what else I could try.

Thanks,
Ron
 
Ad

Advertisements

R

Ron

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)
 
Ad

Advertisements

R

Ron

One more note: goPackage...Remove goes before
goPackage.UnInitialize. And also, keep the Module/class
level goPackage vars private. This is for when you have
to call the dts package multiple times while the
app/project is running.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top