dbTalk Databases Forums  

getting DestinationObjectName from package using VB6

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss getting DestinationObjectName from package using VB6 in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dan
 
Posts: n/a

Default getting DestinationObjectName from package using VB6 - 05-03-2004 , 03:16 PM






I'm using VB6 and SS2000. I want to look through all of the DTS Data Pump
Tasks in a package. I'm trying to find a package that contains a certain
table. I pulled some code from MS site but it is creating a datapump object
and I want to find one. I having trouble instantiating the object. I don't
know how to do it and then I want to loop through the datapump objects in
the package and look at both the DestinationObjectName and the
SourceObjectName. How do I instantiate the data pump object for the package
that I'm connected to? This is the code I have so far. I was able to loop
through the tasks but then I discovered that what I'm looking for is in the
datapump.

'Declare variables
Dim x As Integer
Dim oPkg

' Assign parameters
sServer = "(local)"
sUID = ""
sPWD = ""
iSecurity = DTSSQLStgFlag_UseTrustedConnection
sPkgPWD = ""
sPkgName = "Fetch and Process the Stores File from the web"

' Load Package
Set pkg = New DTS.Package2

pkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity, sPkgPWD, "", "",
sPkgName

' this code doesn't work
Dim objDataPump As DTS.DataPumpTask2
objDataPump.DestinationObjectName


' this part works ok but what I'm looking for isn't here
For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

'Clean up
pkg.UnInitialize
Set pkg = Nothing

Thanks,

Dan



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: getting DestinationObjectName from package using VB6 - 05-03-2004 , 03:55 PM






OK this is using .Net (I don't have the classic version of VB)

Dim p As New DTS.Package

Dim cus As DTS.CustomTask

Dim dpTask As DTS.DataPumpTask



p.LoadFromSQLServer("MyBigAndBadServer", , ,
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrus tedConnection, , , ,
"FindTheDataPumps")

For Each tsk As DTS.Task In p.Tasks

If tsk.CustomTaskID = "DTSDataPumpTask" Then

dpTask = tsk.CustomTask

MessageBox.Show(dpTask.DestinationObjectName)

End If

Next

p.UnInitialize()


You can loop through packages on the server using this article code

Enumerating DTS Packages using VB.Net
(http://www.sqldts.com/default.aspx?250)




--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote

Quote:
I'm using VB6 and SS2000. I want to look through all of the DTS Data Pump
Tasks in a package. I'm trying to find a package that contains a certain
table. I pulled some code from MS site but it is creating a datapump
object
and I want to find one. I having trouble instantiating the object. I don't
know how to do it and then I want to loop through the datapump objects in
the package and look at both the DestinationObjectName and the
SourceObjectName. How do I instantiate the data pump object for the
package
that I'm connected to? This is the code I have so far. I was able to loop
through the tasks but then I discovered that what I'm looking for is in
the
datapump.

'Declare variables
Dim x As Integer
Dim oPkg

' Assign parameters
sServer = "(local)"
sUID = ""
sPWD = ""
iSecurity = DTSSQLStgFlag_UseTrustedConnection
sPkgPWD = ""
sPkgName = "Fetch and Process the Stores File from the web"

' Load Package
Set pkg = New DTS.Package2

pkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity, sPkgPWD, "", "",
sPkgName

' this code doesn't work
Dim objDataPump As DTS.DataPumpTask2
objDataPump.DestinationObjectName


' this part works ok but what I'm looking for isn't here
For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

'Clean up
pkg.UnInitialize
Set pkg = Nothing

Thanks,

Dan





Reply With Quote
  #3  
Old   
Dan
 
Posts: n/a

Default Re: getting DestinationObjectName from package using VB6 - 05-03-2004 , 04:21 PM



VB6 doesn't like the line "For each tsk AS DTS.Task in p.tasks". I can look
through the tasks with this:

For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

But how do I get the task.customtaskid once I'm inside the loop?

Thanks,

Dan
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
OK this is using .Net (I don't have the classic version of VB)

Dim p As New DTS.Package

Dim cus As DTS.CustomTask

Dim dpTask As DTS.DataPumpTask



p.LoadFromSQLServer("MyBigAndBadServer", , ,
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrus tedConnection, , , ,
"FindTheDataPumps")

For Each tsk As DTS.Task In p.Tasks

If tsk.CustomTaskID = "DTSDataPumpTask" Then

dpTask = tsk.CustomTask

MessageBox.Show(dpTask.DestinationObjectName)

End If

Next

p.UnInitialize()


You can loop through packages on the server using this article code

Enumerating DTS Packages using VB.Net
(http://www.sqldts.com/default.aspx?250)




--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote in message
news:OVSzTyUMEHA.1348 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I'm using VB6 and SS2000. I want to look through all of the DTS Data
Pump
Tasks in a package. I'm trying to find a package that contains a certain
table. I pulled some code from MS site but it is creating a datapump
object
and I want to find one. I having trouble instantiating the object. I
don't
know how to do it and then I want to loop through the datapump objects
in
the package and look at both the DestinationObjectName and the
SourceObjectName. How do I instantiate the data pump object for the
package
that I'm connected to? This is the code I have so far. I was able to
loop
through the tasks but then I discovered that what I'm looking for is in
the
datapump.

'Declare variables
Dim x As Integer
Dim oPkg

' Assign parameters
sServer = "(local)"
sUID = ""
sPWD = ""
iSecurity = DTSSQLStgFlag_UseTrustedConnection
sPkgPWD = ""
sPkgName = "Fetch and Process the Stores File from the web"

' Load Package
Set pkg = New DTS.Package2

pkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity, sPkgPWD, "",
"",
sPkgName

' this code doesn't work
Dim objDataPump As DTS.DataPumpTask2
objDataPump.DestinationObjectName


' this part works ok but what I'm looking for isn't here
For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

'Clean up
pkg.UnInitialize
Set pkg = Nothing

Thanks,

Dan







Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: getting DestinationObjectName from package using VB6 - 05-03-2004 , 04:48 PM



You should be able to do something like

dim tsk as DTS.Task

for each tsk in pkg.Tasks
msgbox tsk.CustomTaskID
next



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote

Quote:
VB6 doesn't like the line "For each tsk AS DTS.Task in p.tasks". I can
look
through the tasks with this:

For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

But how do I get the task.customtaskid once I'm inside the loop?

Thanks,

Dan
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:%23kBB%23AVMEHA.2068 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
OK this is using .Net (I don't have the classic version of VB)

Dim p As New DTS.Package

Dim cus As DTS.CustomTask

Dim dpTask As DTS.DataPumpTask



p.LoadFromSQLServer("MyBigAndBadServer", , ,
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrus tedConnection, , , ,
"FindTheDataPumps")

For Each tsk As DTS.Task In p.Tasks

If tsk.CustomTaskID = "DTSDataPumpTask" Then

dpTask = tsk.CustomTask

MessageBox.Show(dpTask.DestinationObjectName)

End If

Next

p.UnInitialize()


You can loop through packages on the server using this article code

Enumerating DTS Packages using VB.Net
(http://www.sqldts.com/default.aspx?250)




--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote in message
news:OVSzTyUMEHA.1348 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I'm using VB6 and SS2000. I want to look through all of the DTS Data
Pump
Tasks in a package. I'm trying to find a package that contains a
certain
table. I pulled some code from MS site but it is creating a datapump
object
and I want to find one. I having trouble instantiating the object. I
don't
know how to do it and then I want to loop through the datapump objects
in
the package and look at both the DestinationObjectName and the
SourceObjectName. How do I instantiate the data pump object for the
package
that I'm connected to? This is the code I have so far. I was able to
loop
through the tasks but then I discovered that what I'm looking for is
in
the
datapump.

'Declare variables
Dim x As Integer
Dim oPkg

' Assign parameters
sServer = "(local)"
sUID = ""
sPWD = ""
iSecurity = DTSSQLStgFlag_UseTrustedConnection
sPkgPWD = ""
sPkgName = "Fetch and Process the Stores File from the web"

' Load Package
Set pkg = New DTS.Package2

pkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity, sPkgPWD, "",
"",
sPkgName

' this code doesn't work
Dim objDataPump As DTS.DataPumpTask2
objDataPump.DestinationObjectName


' this part works ok but what I'm looking for isn't here
For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

'Clean up
pkg.UnInitialize
Set pkg = Nothing

Thanks,

Dan









Reply With Quote
  #5  
Old   
Dan
 
Posts: n/a

Default Re: getting DestinationObjectName from package using VB6 - 05-03-2004 , 05:27 PM



Its almost there. I have this:

For Each tsk In pkg.Tasks
MsgBox tsk.CustomTaskID
If tsk.CustomTaskID = "DTSDataPumpTask" Then
dpTask = tsk.CustomTask
MessageBox.Show (dpTask.DestinationObjectName)
End If
Next

The line that starts dpTask gives this error: Object variable or with block
variable not set.

Any idea?

Thanks,

Dan

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
You should be able to do something like

dim tsk as DTS.Task

for each tsk in pkg.Tasks
msgbox tsk.CustomTaskID
next



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote in message
news:u7dZ2WVMEHA.3668 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
VB6 doesn't like the line "For each tsk AS DTS.Task in p.tasks". I can
look
through the tasks with this:

For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

But how do I get the task.customtaskid once I'm inside the loop?

Thanks,

Dan
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:%23kBB%23AVMEHA.2068 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
OK this is using .Net (I don't have the classic version of VB)

Dim p As New DTS.Package

Dim cus As DTS.CustomTask

Dim dpTask As DTS.DataPumpTask



p.LoadFromSQLServer("MyBigAndBadServer", , ,
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrus tedConnection, , , ,
"FindTheDataPumps")

For Each tsk As DTS.Task In p.Tasks

If tsk.CustomTaskID = "DTSDataPumpTask" Then

dpTask = tsk.CustomTask

MessageBox.Show(dpTask.DestinationObjectName)

End If

Next

p.UnInitialize()


You can loop through packages on the server using this article code

Enumerating DTS Packages using VB.Net
(http://www.sqldts.com/default.aspx?250)




--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote in message
news:OVSzTyUMEHA.1348 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I'm using VB6 and SS2000. I want to look through all of the DTS Data
Pump
Tasks in a package. I'm trying to find a package that contains a
certain
table. I pulled some code from MS site but it is creating a datapump
object
and I want to find one. I having trouble instantiating the object. I
don't
know how to do it and then I want to loop through the datapump
objects
in
the package and look at both the DestinationObjectName and the
SourceObjectName. How do I instantiate the data pump object for the
package
that I'm connected to? This is the code I have so far. I was able to
loop
through the tasks but then I discovered that what I'm looking for is
in
the
datapump.

'Declare variables
Dim x As Integer
Dim oPkg

' Assign parameters
sServer = "(local)"
sUID = ""
sPWD = ""
iSecurity = DTSSQLStgFlag_UseTrustedConnection
sPkgPWD = ""
sPkgName = "Fetch and Process the Stores File from the web"

' Load Package
Set pkg = New DTS.Package2

pkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity, sPkgPWD,
"",
"",
sPkgName

' this code doesn't work
Dim objDataPump As DTS.DataPumpTask2
objDataPump.DestinationObjectName


' this part works ok but what I'm looking for isn't here
For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

'Clean up
pkg.UnInitialize
Set pkg = Nothing

Thanks,

Dan











Reply With Quote
  #6  
Old   
Darren Green
 
Posts: n/a

Default Re: getting DestinationObjectName from package using VB6 - 05-04-2004 , 08:22 AM



Dim oTask AS DTS.Task
Dim oDataPump As DTS.DataPumpTask

For Each oTask In oPkg.Tasks
If oTask = "DTSDataPumpTask" Then
Set oDataPump = oTask
MsgBox(oDataPump.DestinationObjectName)
End If
Next

Set oDataPump = Nothing
Set oTask = Nothing


--
Darren Green
http://www.sqldts.com


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote

Quote:
Its almost there. I have this:

For Each tsk In pkg.Tasks
MsgBox tsk.CustomTaskID
If tsk.CustomTaskID = "DTSDataPumpTask" Then
dpTask = tsk.CustomTask
MessageBox.Show (dpTask.DestinationObjectName)
End If
Next

The line that starts dpTask gives this error: Object variable or with
block
variable not set.

Any idea?

Thanks,

Dan

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:urD1jeVMEHA.1340 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
You should be able to do something like

dim tsk as DTS.Task

for each tsk in pkg.Tasks
msgbox tsk.CustomTaskID
next



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote in message
news:u7dZ2WVMEHA.3668 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
VB6 doesn't like the line "For each tsk AS DTS.Task in p.tasks". I can
look
through the tasks with this:

For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

But how do I get the task.customtaskid once I'm inside the loop?

Thanks,

Dan
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:%23kBB%23AVMEHA.2068 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
OK this is using .Net (I don't have the classic version of VB)

Dim p As New DTS.Package

Dim cus As DTS.CustomTask

Dim dpTask As DTS.DataPumpTask



p.LoadFromSQLServer("MyBigAndBadServer", , ,
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrus tedConnection, , ,
,
"FindTheDataPumps")

For Each tsk As DTS.Task In p.Tasks

If tsk.CustomTaskID = "DTSDataPumpTask" Then

dpTask = tsk.CustomTask

MessageBox.Show(dpTask.DestinationObjectName)

End If

Next

p.UnInitialize()


You can loop through packages on the server using this article code

Enumerating DTS Packages using VB.Net
(http://www.sqldts.com/default.aspx?250)




--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote in message
news:OVSzTyUMEHA.1348 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I'm using VB6 and SS2000. I want to look through all of the DTS
Data
Pump
Tasks in a package. I'm trying to find a package that contains a
certain
table. I pulled some code from MS site but it is creating a
datapump
object
and I want to find one. I having trouble instantiating the object.
I
don't
know how to do it and then I want to loop through the datapump
objects
in
the package and look at both the DestinationObjectName and the
SourceObjectName. How do I instantiate the data pump object for
the
package
that I'm connected to? This is the code I have so far. I was able
to
loop
through the tasks but then I discovered that what I'm looking for
is
in
the
datapump.

'Declare variables
Dim x As Integer
Dim oPkg

' Assign parameters
sServer = "(local)"
sUID = ""
sPWD = ""
iSecurity = DTSSQLStgFlag_UseTrustedConnection
sPkgPWD = ""
sPkgName = "Fetch and Process the Stores File from the web"

' Load Package
Set pkg = New DTS.Package2

pkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity, sPkgPWD,
"",
"",
sPkgName

' this code doesn't work
Dim objDataPump As DTS.DataPumpTask2
objDataPump.DestinationObjectName


' this part works ok but what I'm looking for isn't here
For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

'Clean up
pkg.UnInitialize
Set pkg = Nothing

Thanks,

Dan













Reply With Quote
  #7  
Old   
Dan
 
Posts: n/a

Default Re: getting DestinationObjectName from package using VB6 - 05-04-2004 , 08:49 AM



Darren,

As soon as the debugger tries to leave the line "If oTask =
"DTSDataPumpTask" Then" I get an "object doesn't support this property or
method. If I change the line to be more like what Allan used - "If
oTask.CustomTaskId = "DTSDataPumpTask" then I don't get the error on that
line but when the code goes into the "If" statement I get a "type mismatch"
error on the line - "Set oDataPump = oTask"

Oh. I got it! I changed the line to ""Set oDataPump = oTask.CustomTask" and
it worked. Great!

Thanks Darren and thanks Allan.

Dan

"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote

Quote:
Dim oTask AS DTS.Task
Dim oDataPump As DTS.DataPumpTask

For Each oTask In oPkg.Tasks
If oTask = "DTSDataPumpTask" Then
Set oDataPump = oTask
MsgBox(oDataPump.DestinationObjectName)
End If
Next

Set oDataPump = Nothing
Set oTask = Nothing


--
Darren Green
http://www.sqldts.com


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote in message
news:%23fiGm7VMEHA.2488 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Its almost there. I have this:

For Each tsk In pkg.Tasks
MsgBox tsk.CustomTaskID
If tsk.CustomTaskID = "DTSDataPumpTask" Then
dpTask = tsk.CustomTask
MessageBox.Show (dpTask.DestinationObjectName)
End If
Next

The line that starts dpTask gives this error: Object variable or with
block
variable not set.

Any idea?

Thanks,

Dan

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:urD1jeVMEHA.1340 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
You should be able to do something like

dim tsk as DTS.Task

for each tsk in pkg.Tasks
msgbox tsk.CustomTaskID
next



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote in message
news:u7dZ2WVMEHA.3668 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
VB6 doesn't like the line "For each tsk AS DTS.Task in p.tasks". I
can
look
through the tasks with this:

For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

But how do I get the task.customtaskid once I'm inside the loop?

Thanks,

Dan
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:%23kBB%23AVMEHA.2068 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
OK this is using .Net (I don't have the classic version of VB)

Dim p As New DTS.Package

Dim cus As DTS.CustomTask

Dim dpTask As DTS.DataPumpTask



p.LoadFromSQLServer("MyBigAndBadServer", , ,
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrus tedConnection, ,
,
,
"FindTheDataPumps")

For Each tsk As DTS.Task In p.Tasks

If tsk.CustomTaskID = "DTSDataPumpTask" Then

dpTask = tsk.CustomTask

MessageBox.Show(dpTask.DestinationObjectName)

End If

Next

p.UnInitialize()


You can loop through packages on the server using this article
code

Enumerating DTS Packages using VB.Net
(http://www.sqldts.com/default.aspx?250)




--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Dan" <ddonahue (AT) archermalmo (DOT) com> wrote in message
news:OVSzTyUMEHA.1348 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I'm using VB6 and SS2000. I want to look through all of the DTS
Data
Pump
Tasks in a package. I'm trying to find a package that contains a
certain
table. I pulled some code from MS site but it is creating a
datapump
object
and I want to find one. I having trouble instantiating the
object.
I
don't
know how to do it and then I want to loop through the datapump
objects
in
the package and look at both the DestinationObjectName and the
SourceObjectName. How do I instantiate the data pump object for
the
package
that I'm connected to? This is the code I have so far. I was
able
to
loop
through the tasks but then I discovered that what I'm looking
for
is
in
the
datapump.

'Declare variables
Dim x As Integer
Dim oPkg

' Assign parameters
sServer = "(local)"
sUID = ""
sPWD = ""
iSecurity = DTSSQLStgFlag_UseTrustedConnection
sPkgPWD = ""
sPkgName = "Fetch and Process the Stores File from the web"

' Load Package
Set pkg = New DTS.Package2

pkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity,
sPkgPWD,
"",
"",
sPkgName

' this code doesn't work
Dim objDataPump As DTS.DataPumpTask2
objDataPump.DestinationObjectName


' this part works ok but what I'm looking for isn't here
For x = 1 To pkg.Tasks.Count
pkg.Tasks.Item (x)
Next x

'Clean up
pkg.UnInitialize
Set pkg = Nothing

Thanks,

Dan















Reply With Quote
  #8  
Old   
Darren Green
 
Posts: n/a

Default Re: getting DestinationObjectName from package using VB6 - 05-04-2004 , 04:44 PM



In message <esM#4#dMEHA.3380 (AT) TK2MSFTNGP11 (DOT) phx.gbl>, Dan
<ddonahue (AT) archermalmo (DOT) com> writes
Quote:
Darren,

As soon as the debugger tries to leave the line "If oTask =
"DTSDataPumpTask" Then" I get an "object doesn't support this property or
method. If I change the line to be more like what Allan used - "If
oTask.CustomTaskId = "DTSDataPumpTask" then I don't get the error on that
line but when the code goes into the "If" statement I get a "type mismatch"
error on the line - "Set oDataPump = oTask"

Oh. I got it! I changed the line to ""Set oDataPump = oTask.CustomTask" and
it worked. Great!

Bugger!! I meant to highlight the lack of Set as required object
assignment, and thought I'd include a full code sample, but
unfortunately I failed on both counts! Glad you made it there despite my
attempts

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.