Precedence Error in VB.Net -
07-16-2003
, 01:59 PM
I have a package that I created in SQL, then recorded for VB.Net. The
package has 3 steps.
Step 1: DTSExecuteSQLTask: Delete Rows
Step 2: BulkInsert
Step 3: DTSExecuteSQLTask: Execute a Stored Proc
First I coded each step seperatly, using 3 diferent commnad buttons.
Pushing the buttons in sequence, the package works great.
I then tried to put together the 3 steps, but when I copied the code
for the precedence, there is an error, here is the code:
'------------- a precedence constraint for steps defined below
Set oStep = goPackage.Steps("DTSStep_DTSBulkInsertTask_1")
Set oPrecConstraint =
oStep.PrecedenceConstraints.New("DTSStep_DTSExecut eSQLTask_1")
oPrecConstraint.StepName = "DTSStep_DTSExecuteSQLTask_1"
oPrecConstraint.PrecedenceBasis = 0
oPrecConstraint.Value = 4
The error is on the 1st line of code:
Set oSrep = goPackage.Steps("DTSStep_DTSBulkInsertTask_1")
The Debugger does not like "Steps(("DTSStep_DTSBulkInsertTask_1")
It says : Interface 'DTS.Steps' cannot be indexed because it has no
default property.
I did some reading, and found examples that put the Keyword 'Item'
after the word 'Steps'. I tried that, and the error in the Debugger
went away, but the package does not execute.
This is what I tried:
oStep = goPackage.Steps.Item("DTSStep_DTSBulkInsertTask_1" )
oPrecConstraint =
oStep.PrecedenceConstraints.New("DTSStep_DTSExecut eSQLTask_1")
oPrecConstraint.StepName = "DTSStep_DTSExecuteSQLTask_1"
oPrecConstraint.PrecedenceBasis = 0
oPrecConstraint.Value = 4
Does anybody have any idead how to get the precedence to work?
Here is my complete precendence code, also does the precedence go in a
certain order as you build the package?
Dim oPrecConstraint As DTS.PrecedenceConstraint
oStep = goPackage.Steps.Item("DTSStep_DTSBulkInsertTask_1" )
oPrecConstraint =
oStep.PrecedenceConstraints.New("DTSStep_DTSExecut eSQLTask_1")
oPrecConstraint.StepName = "DTSStep_DTSExecuteSQLTask_1"
oPrecConstraint.PrecedenceBasis = 0
oPrecConstraint.Value = 4
oStep.PrecedenceConstraints.Add(oPrecConstraint)
oPrecConstraint = Nothing
oStep = goPackage.Steps.Item("DTSStep_DTSExecuteSQLTask_2" )
oPrecConstraint =
oStep.PrecedenceConstraints.New("DTSStep_DTSBulkIn sertTask_1")
oPrecConstraint.StepName = "DTSStep_DTSBulkInsertTask_1"
oPrecConstraint.PrecedenceBasis = 0
oPrecConstraint.Value = 4
oStep.PrecedenceConstraints.Add(oPrecConstraint)
oPrecConstraint = Nothing
Thanks all,
rwiethorn |